diff --git a/contracts/contracts/MACI.sol b/contracts/contracts/MACI.sol index bd9b2f7b6b..8bed750c89 100644 --- a/contracts/contracts/MACI.sol +++ b/contracts/contracts/MACI.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { IPollFactory } from "./interfaces/IPollFactory.sol"; import { IMessageProcessorFactory } from "./interfaces/IMPFactory.sol"; @@ -17,7 +17,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /// @title MACI - Minimum Anti-Collusion Infrastructure Version 1 /// @notice A contract which allows users to sign up, and deploy new polls -contract MACI is IMACI, DomainObjs, Params, Utilities, Ownable { +contract MACI is IMACI, DomainObjs, Params, Utilities, Ownable(msg.sender) { /// @notice The state tree depth is fixed. As such it should be as large as feasible /// so that there can be as many users as possible. i.e. 5 ** 10 = 9765625 /// this should also match the parameter of the circom circuits. diff --git a/contracts/contracts/MessageProcessor.sol b/contracts/contracts/MessageProcessor.sol index de411a246c..866ef9f634 100644 --- a/contracts/contracts/MessageProcessor.sol +++ b/contracts/contracts/MessageProcessor.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { AccQueue } from "./trees/AccQueue.sol"; import { IMACI } from "./interfaces/IMACI.sol"; @@ -17,7 +17,7 @@ import { DomainObjs } from "./utilities/DomainObjs.sol"; /// @dev MessageProcessor is used to process messages published by signup users. /// It will process message by batch due to large size of messages. /// After it finishes processing, the sbCommitment will be used for Tally and Subsidy contracts. -contract MessageProcessor is Ownable, SnarkCommon, Hasher, CommonUtilities, IMessageProcessor, DomainObjs { +contract MessageProcessor is Ownable(msg.sender), SnarkCommon, Hasher, CommonUtilities, IMessageProcessor, DomainObjs { /// @notice custom errors error NoMoreMessages(); error StateAqNotMerged(); diff --git a/contracts/contracts/Poll.sol b/contracts/contracts/Poll.sol index 9bc9184bb4..4480bd2701 100644 --- a/contracts/contracts/Poll.sol +++ b/contracts/contracts/Poll.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Params } from "./utilities/Params.sol"; import { SnarkCommon } from "./crypto/SnarkCommon.sol"; @@ -15,7 +15,7 @@ import { Utilities } from "./utilities/Utilities.sol"; /// which can be either votes, key change messages or topup messages. /// @dev Do not deploy this directly. Use PollFactory.deploy() which performs some /// checks on the Poll constructor arguments. -contract Poll is Params, Utilities, SnarkCommon, Ownable, EmptyBallotRoots, IPoll { +contract Poll is Params, Utilities, SnarkCommon, Ownable(msg.sender), EmptyBallotRoots, IPoll { using SafeERC20 for ERC20; /// @notice Whether the Poll has been initialized diff --git a/contracts/contracts/PollFactory.sol b/contracts/contracts/PollFactory.sol index ae62a1b761..5cff4bd914 100644 --- a/contracts/contracts/PollFactory.sol +++ b/contracts/contracts/PollFactory.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { IMACI } from "./interfaces/IMACI.sol"; import { AccQueue } from "./trees/AccQueue.sol"; diff --git a/contracts/contracts/SignUpToken.sol b/contracts/contracts/SignUpToken.sol index 759a719d13..e069c06004 100644 --- a/contracts/contracts/SignUpToken.sol +++ b/contracts/contracts/SignUpToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; @@ -7,7 +7,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /// @title SignUpToken /// @notice This contract is an ERC721 token contract which /// can be used to allow users to sign up for a poll. -contract SignUpToken is ERC721, Ownable { +contract SignUpToken is ERC721, Ownable(msg.sender) { /// @notice The constructor which calls the ERC721 constructor constructor() payable ERC721("SignUpToken", "SignUpToken") {} diff --git a/contracts/contracts/Tally.sol b/contracts/contracts/Tally.sol index 3ae0165cb5..6929436400 100644 --- a/contracts/contracts/Tally.sol +++ b/contracts/contracts/Tally.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { IMACI } from "./interfaces/IMACI.sol"; import { Hasher } from "./crypto/Hasher.sol"; @@ -15,7 +15,7 @@ import { DomainObjs } from "./utilities/DomainObjs.sol"; /// @title Tally /// @notice The Tally contract is used during votes tallying /// and by users to verify the tally results. -contract Tally is Ownable, SnarkCommon, CommonUtilities, Hasher, DomainObjs { +contract Tally is Ownable(msg.sender), SnarkCommon, CommonUtilities, Hasher, DomainObjs { uint256 internal constant TREE_ARITY = 5; /// @notice The commitment to the tally results. Its initial value is 0, but after diff --git a/contracts/contracts/TopupCredit.sol b/contracts/contracts/TopupCredit.sol index e3c09f71a8..9a13ebe938 100644 --- a/contracts/contracts/TopupCredit.sol +++ b/contracts/contracts/TopupCredit.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; @@ -7,7 +7,7 @@ import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; /// @title TopupCredit /// @notice A contract representing a token used to topup a MACI's voter /// credits -contract TopupCredit is ERC20, Ownable { +contract TopupCredit is ERC20, Ownable(msg.sender) { uint8 public constant DECIMALS = 1; uint256 public constant MAXIMUM_AIRDROP_AMOUNT = 100000 * 10 ** DECIMALS; diff --git a/contracts/contracts/VkRegistry.sol b/contracts/contracts/VkRegistry.sol index 2298d34f89..f0b26d9e78 100644 --- a/contracts/contracts/VkRegistry.sol +++ b/contracts/contracts/VkRegistry.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { SnarkCommon } from "./crypto/SnarkCommon.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; @@ -10,7 +10,7 @@ import { DomainObjs } from "./utilities/DomainObjs.sol"; /// @notice Stores verifying keys for the circuits. /// Each circuit has a signature which is its compile-time constants represented /// as a uint256. -contract VkRegistry is Ownable, DomainObjs, SnarkCommon, IVkRegistry { +contract VkRegistry is Ownable(msg.sender), DomainObjs, SnarkCommon, IVkRegistry { mapping(Mode => mapping(uint256 => VerifyingKey)) internal processVks; mapping(Mode => mapping(uint256 => bool)) internal processVkSet; diff --git a/contracts/contracts/benchmarks/HasherBenchmarks.sol b/contracts/contracts/benchmarks/HasherBenchmarks.sol index 27327ef87e..4a99af88a1 100644 --- a/contracts/contracts/benchmarks/HasherBenchmarks.sol +++ b/contracts/contracts/benchmarks/HasherBenchmarks.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Hasher } from "../crypto/Hasher.sol"; diff --git a/contracts/contracts/crypto/Hasher.sol b/contracts/contracts/crypto/Hasher.sol index d332a8bcc0..9445bd6da6 100644 --- a/contracts/contracts/crypto/Hasher.sol +++ b/contracts/contracts/crypto/Hasher.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { SnarkConstants } from "./SnarkConstants.sol"; import { PoseidonT3 } from "./PoseidonT3.sol"; diff --git a/contracts/contracts/crypto/MockVerifier.sol b/contracts/contracts/crypto/MockVerifier.sol index d9a8b00edc..2b8507a023 100644 --- a/contracts/contracts/crypto/MockVerifier.sol +++ b/contracts/contracts/crypto/MockVerifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { SnarkConstants } from "./SnarkConstants.sol"; import { SnarkCommon } from "./SnarkCommon.sol"; diff --git a/contracts/contracts/crypto/Pairing.sol b/contracts/contracts/crypto/Pairing.sol index 9239d19519..4c65e101ac 100644 --- a/contracts/contracts/crypto/Pairing.sol +++ b/contracts/contracts/crypto/Pairing.sol @@ -18,7 +18,7 @@ // 2019 OKIMS -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @title Pairing /// @notice A library implementing the alt_bn128 elliptic curve operations. diff --git a/contracts/contracts/crypto/PoseidonT3.sol b/contracts/contracts/crypto/PoseidonT3.sol index c9825d32de..be8d47e060 100644 --- a/contracts/contracts/crypto/PoseidonT3.sol +++ b/contracts/contracts/crypto/PoseidonT3.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @notice A library which provides functions for computing Pedersen hashes. library PoseidonT3 { diff --git a/contracts/contracts/crypto/PoseidonT4.sol b/contracts/contracts/crypto/PoseidonT4.sol index 615c955f9e..2187bc8333 100644 --- a/contracts/contracts/crypto/PoseidonT4.sol +++ b/contracts/contracts/crypto/PoseidonT4.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @notice A library which provides functions for computing Pedersen hashes. library PoseidonT4 { diff --git a/contracts/contracts/crypto/PoseidonT5.sol b/contracts/contracts/crypto/PoseidonT5.sol index 46bb22e028..af57b2f314 100644 --- a/contracts/contracts/crypto/PoseidonT5.sol +++ b/contracts/contracts/crypto/PoseidonT5.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @notice A library which provides functions for computing Pedersen hashes. library PoseidonT5 { diff --git a/contracts/contracts/crypto/PoseidonT6.sol b/contracts/contracts/crypto/PoseidonT6.sol index 1f677da10d..820613be67 100644 --- a/contracts/contracts/crypto/PoseidonT6.sol +++ b/contracts/contracts/crypto/PoseidonT6.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @notice A library which provides functions for computing Pedersen hashes. library PoseidonT6 { diff --git a/contracts/contracts/crypto/SnarkCommon.sol b/contracts/contracts/crypto/SnarkCommon.sol index e63bd8ec5f..acdd65e1bf 100644 --- a/contracts/contracts/crypto/SnarkCommon.sol +++ b/contracts/contracts/crypto/SnarkCommon.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Pairing } from "./Pairing.sol"; /// @title SnarkCommon diff --git a/contracts/contracts/crypto/SnarkConstants.sol b/contracts/contracts/crypto/SnarkConstants.sol index e263121fce..dd0075b680 100644 --- a/contracts/contracts/crypto/SnarkConstants.sol +++ b/contracts/contracts/crypto/SnarkConstants.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @title SnarkConstants /// @notice This contract contains constants related to the SNARK diff --git a/contracts/contracts/crypto/Verifier.sol b/contracts/contracts/crypto/Verifier.sol index 7654fe6bb0..68363e7e2b 100644 --- a/contracts/contracts/crypto/Verifier.sol +++ b/contracts/contracts/crypto/Verifier.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Pairing } from "./Pairing.sol"; import { SnarkConstants } from "./SnarkConstants.sol"; diff --git a/contracts/contracts/gatekeepers/EASGatekeeper.sol b/contracts/contracts/gatekeepers/EASGatekeeper.sol index 0379a8cab8..ad080f4a47 100644 --- a/contracts/contracts/gatekeepers/EASGatekeeper.sol +++ b/contracts/contracts/gatekeepers/EASGatekeeper.sol @@ -9,7 +9,7 @@ import { IEAS } from "../interfaces/IEAS.sol"; /// @title EASGatekeeper /// @notice A gatekeeper contract which allows users to sign up to MACI /// only if they've received an attestation of a specific schema from a trusted attester -contract EASGatekeeper is SignUpGatekeeper, Ownable { +contract EASGatekeeper is SignUpGatekeeper, Ownable(msg.sender) { // the reference to the EAS contract IEAS private immutable eas; @@ -38,7 +38,7 @@ contract EASGatekeeper is SignUpGatekeeper, Ownable { /// @param _eas The EAS contract /// @param _attester The trusted attester /// @param _schema The schema UID - constructor(address _eas, address _attester, bytes32 _schema) payable Ownable() { + constructor(address _eas, address _attester, bytes32 _schema) payable { if (_eas == address(0) || _attester == address(0)) revert ZeroAddress(); eas = IEAS(_eas); schema = _schema; diff --git a/contracts/contracts/gatekeepers/FreeForAllSignUpGatekeeper.sol b/contracts/contracts/gatekeepers/FreeForAllSignUpGatekeeper.sol index 9637e02d63..09a4b0d1a7 100644 --- a/contracts/contracts/gatekeepers/FreeForAllSignUpGatekeeper.sol +++ b/contracts/contracts/gatekeepers/FreeForAllSignUpGatekeeper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; diff --git a/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol b/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol index 6eda9e9e05..566c2b47f0 100644 --- a/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol +++ b/contracts/contracts/gatekeepers/HatsGatekeeperBase.sol @@ -8,7 +8,7 @@ import { SignUpGatekeeper } from "./SignUpGatekeeper.sol"; /// @title HatsGatekeeperBase /// @notice Abstract contract containing the base elements of a Hats Gatekeeper contract -abstract contract HatsGatekeeperBase is SignUpGatekeeper, Ownable { +abstract contract HatsGatekeeperBase is SignUpGatekeeper, Ownable(msg.sender) { /*////////////////////////////////////////////////////////////// CUSTOM ERRORS //////////////////////////////////////////////////////////////*/ diff --git a/contracts/contracts/gatekeepers/SignUpGatekeeper.sol b/contracts/contracts/gatekeepers/SignUpGatekeeper.sol index 2e1a23b1ff..4cebc106d8 100644 --- a/contracts/contracts/gatekeepers/SignUpGatekeeper.sol +++ b/contracts/contracts/gatekeepers/SignUpGatekeeper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @title SignUpGatekeeper /// @notice A gatekeeper contract which allows users to sign up for a poll. diff --git a/contracts/contracts/gatekeepers/SignUpTokenGatekeeper.sol b/contracts/contracts/gatekeepers/SignUpTokenGatekeeper.sol index e3dcfd7308..bc62b523ea 100644 --- a/contracts/contracts/gatekeepers/SignUpTokenGatekeeper.sol +++ b/contracts/contracts/gatekeepers/SignUpTokenGatekeeper.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; @@ -9,7 +9,7 @@ import { SignUpToken } from "../SignUpToken.sol"; /// @title SignUpTokenGatekeeper /// @notice This contract allows to gatekeep MACI signups /// by requiring new voters to own a certain ERC721 token -contract SignUpTokenGatekeeper is SignUpGatekeeper, Ownable { +contract SignUpTokenGatekeeper is SignUpGatekeeper, Ownable(msg.sender) { /// @notice the reference to the SignUpToken contract SignUpToken public token; /// @notice the reference to the MACI contract @@ -25,7 +25,7 @@ contract SignUpTokenGatekeeper is SignUpGatekeeper, Ownable { /// @notice creates a new SignUpTokenGatekeeper /// @param _token the address of the SignUpToken contract - constructor(SignUpToken _token) payable Ownable() { + constructor(SignUpToken _token) payable { token = _token; } diff --git a/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol b/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol index d9aefa7a0d..b5d6db4f3d 100644 --- a/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol +++ b/contracts/contracts/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { InitialVoiceCreditProxy } from "./InitialVoiceCreditProxy.sol"; diff --git a/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol b/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol index 246ec33729..6531fdf7d3 100644 --- a/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol +++ b/contracts/contracts/initialVoiceCreditProxy/InitialVoiceCreditProxy.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @title InitialVoiceCreditProxy /// @notice This contract is the base contract for diff --git a/contracts/contracts/interfaces/IMACI.sol b/contracts/contracts/interfaces/IMACI.sol index 3060bc9ab5..2323c4fcde 100644 --- a/contracts/contracts/interfaces/IMACI.sol +++ b/contracts/contracts/interfaces/IMACI.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { AccQueue } from "../trees/AccQueue.sol"; diff --git a/contracts/contracts/trees/AccQueue.sol b/contracts/contracts/trees/AccQueue.sol index 7e1f6fe2a9..ef6de8af03 100644 --- a/contracts/contracts/trees/AccQueue.sol +++ b/contracts/contracts/trees/AccQueue.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { Hasher } from "../crypto/Hasher.sol"; @@ -10,7 +10,7 @@ import { Hasher } from "../crypto/Hasher.sol"; /// subtrees together. Merging subtrees requires at least 2 operations: /// mergeSubRoots(), and merge(). To get around the gas limit, /// the mergeSubRoots() can be performed in multiple transactions. -abstract contract AccQueue is Ownable, Hasher { +abstract contract AccQueue is Ownable(msg.sender), Hasher { // The maximum tree depth uint256 public constant MAX_DEPTH = 32; diff --git a/contracts/contracts/trees/AccQueueBinary.sol b/contracts/contracts/trees/AccQueueBinary.sol index c66172d189..c652b18bd7 100644 --- a/contracts/contracts/trees/AccQueueBinary.sol +++ b/contracts/contracts/trees/AccQueueBinary.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { AccQueue } from "./AccQueue.sol"; diff --git a/contracts/contracts/trees/AccQueueBinary0.sol b/contracts/contracts/trees/AccQueueBinary0.sol index 93fe50ce56..33c5eeba14 100644 --- a/contracts/contracts/trees/AccQueueBinary0.sol +++ b/contracts/contracts/trees/AccQueueBinary0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { MerkleZeros as MerkleBinary0 } from "./zeros/MerkleBinary0.sol"; import { AccQueueBinary } from "./AccQueueBinary.sol"; diff --git a/contracts/contracts/trees/AccQueueBinaryMaci.sol b/contracts/contracts/trees/AccQueueBinaryMaci.sol index 5d545f2b00..0291e9d322 100644 --- a/contracts/contracts/trees/AccQueueBinaryMaci.sol +++ b/contracts/contracts/trees/AccQueueBinaryMaci.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { MerkleZeros as MerkleBinaryMaci } from "./zeros/MerkleBinaryMaci.sol"; import { AccQueueBinary } from "./AccQueueBinary.sol"; diff --git a/contracts/contracts/trees/AccQueueQuinary.sol b/contracts/contracts/trees/AccQueueQuinary.sol index 25d8d3d3e4..c31d54dd2c 100644 --- a/contracts/contracts/trees/AccQueueQuinary.sol +++ b/contracts/contracts/trees/AccQueueQuinary.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { AccQueue } from "./AccQueue.sol"; diff --git a/contracts/contracts/trees/AccQueueQuinary0.sol b/contracts/contracts/trees/AccQueueQuinary0.sol index f8edfcfc04..9ac606a5c8 100644 --- a/contracts/contracts/trees/AccQueueQuinary0.sol +++ b/contracts/contracts/trees/AccQueueQuinary0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { MerkleZeros as MerkleQuinary0 } from "./zeros/MerkleQuinary0.sol"; import { AccQueueQuinary } from "./AccQueueQuinary.sol"; diff --git a/contracts/contracts/trees/AccQueueQuinaryBlankSl.sol b/contracts/contracts/trees/AccQueueQuinaryBlankSl.sol index ca7e8c1741..c629677cd8 100644 --- a/contracts/contracts/trees/AccQueueQuinaryBlankSl.sol +++ b/contracts/contracts/trees/AccQueueQuinaryBlankSl.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { MerkleZeros as MerkleQuinaryBlankSl } from "./zeros/MerkleQuinaryBlankSl.sol"; import { AccQueueQuinary } from "./AccQueueQuinary.sol"; diff --git a/contracts/contracts/trees/AccQueueQuinaryMaci.sol b/contracts/contracts/trees/AccQueueQuinaryMaci.sol index 01980fc37a..cfb5533311 100644 --- a/contracts/contracts/trees/AccQueueQuinaryMaci.sol +++ b/contracts/contracts/trees/AccQueueQuinaryMaci.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { MerkleZeros as MerkleQuinaryMaci } from "./zeros/MerkleQuinaryMaci.sol"; import { AccQueueQuinary } from "./AccQueueQuinary.sol"; diff --git a/contracts/contracts/trees/EmptyBallotRoots.sol b/contracts/contracts/trees/EmptyBallotRoots.sol index 854685c95d..4dc8cd6862 100644 --- a/contracts/contracts/trees/EmptyBallotRoots.sol +++ b/contracts/contracts/trees/EmptyBallotRoots.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract EmptyBallotRoots { // emptyBallotRoots contains the roots of Ballot trees of five leaf diff --git a/contracts/contracts/trees/zeros/MerkleBinary0.sol b/contracts/contracts/trees/zeros/MerkleBinary0.sol index 91e0ac1c48..3ff547ff70 100644 --- a/contracts/contracts/trees/zeros/MerkleBinary0.sol +++ b/contracts/contracts/trees/zeros/MerkleBinary0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/trees/zeros/MerkleBinaryMaci.sol b/contracts/contracts/trees/zeros/MerkleBinaryMaci.sol index 2fd0a3ba0e..370efb087c 100644 --- a/contracts/contracts/trees/zeros/MerkleBinaryMaci.sol +++ b/contracts/contracts/trees/zeros/MerkleBinaryMaci.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/trees/zeros/MerkleQuinary0.sol b/contracts/contracts/trees/zeros/MerkleQuinary0.sol index 31d363f48e..e8806376bb 100644 --- a/contracts/contracts/trees/zeros/MerkleQuinary0.sol +++ b/contracts/contracts/trees/zeros/MerkleQuinary0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/trees/zeros/MerkleQuinaryBlankSl.sol b/contracts/contracts/trees/zeros/MerkleQuinaryBlankSl.sol index 2f673546fd..4f3a8fe09d 100644 --- a/contracts/contracts/trees/zeros/MerkleQuinaryBlankSl.sol +++ b/contracts/contracts/trees/zeros/MerkleQuinaryBlankSl.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/trees/zeros/MerkleQuinaryMaci.sol b/contracts/contracts/trees/zeros/MerkleQuinaryMaci.sol index 769b138b00..c120dbec49 100644 --- a/contracts/contracts/trees/zeros/MerkleQuinaryMaci.sol +++ b/contracts/contracts/trees/zeros/MerkleQuinaryMaci.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/trees/zeros/MerkleQuinaryMaciWithSha256.sol b/contracts/contracts/trees/zeros/MerkleQuinaryMaciWithSha256.sol index d5f4001482..f21468cf9d 100644 --- a/contracts/contracts/trees/zeros/MerkleQuinaryMaciWithSha256.sol +++ b/contracts/contracts/trees/zeros/MerkleQuinaryMaciWithSha256.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[33] internal zeros; diff --git a/contracts/contracts/utilities/CommonUtilities.sol b/contracts/contracts/utilities/CommonUtilities.sol index 901d017ad4..01d99ff0fe 100644 --- a/contracts/contracts/utilities/CommonUtilities.sol +++ b/contracts/contracts/utilities/CommonUtilities.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { IPoll } from "../interfaces/IPoll.sol"; diff --git a/contracts/contracts/utilities/DomainObjs.sol b/contracts/contracts/utilities/DomainObjs.sol index 41b0f7b12d..c5bbb1072d 100644 --- a/contracts/contracts/utilities/DomainObjs.sol +++ b/contracts/contracts/utilities/DomainObjs.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; /// @title DomainObjs /// @notice An utility contract that holds diff --git a/contracts/contracts/utilities/Params.sol b/contracts/contracts/utilities/Params.sol index 8d48e19213..a3ad64d5cc 100644 --- a/contracts/contracts/utilities/Params.sol +++ b/contracts/contracts/utilities/Params.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { IMACI } from "../interfaces/IMACI.sol"; import { AccQueue } from "../trees/AccQueue.sol"; diff --git a/contracts/contracts/utilities/Utilities.sol b/contracts/contracts/utilities/Utilities.sol index 488bf39896..6a5216c7f6 100644 --- a/contracts/contracts/utilities/Utilities.sol +++ b/contracts/contracts/utilities/Utilities.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; import { DomainObjs } from "./DomainObjs.sol"; import { Hasher } from "../crypto/Hasher.sol"; import { SnarkConstants } from "../crypto/SnarkConstants.sol"; diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index a88f232555..a6ea992a10 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -47,7 +47,7 @@ const getCommonNetworkConfig = (networkName: ESupportedChains, chainId: number, const config: HardhatUserConfig = { solidity: { - version: "0.8.10", + version: "0.8.20", settings: { optimizer: { enabled: true, diff --git a/contracts/package.json b/contracts/package.json index 6963bfc1ab..7388bf6d92 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -72,7 +72,7 @@ "dependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.5", "@nomicfoundation/hardhat-toolbox": "^5.0.0", - "@openzeppelin/contracts": "^4.8.0", + "@openzeppelin/contracts": "^5.0.2", "circomlibjs": "^0.1.7", "ethers": "^6.11.1", "hardhat": "^2.22.2", diff --git a/contracts/templates/EmptyBallotRoots.sol.template b/contracts/templates/EmptyBallotRoots.sol.template index f0ce1bf8b9..66f440d909 100644 --- a/contracts/templates/EmptyBallotRoots.sol.template +++ b/contracts/templates/EmptyBallotRoots.sol.template @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract EmptyBallotRoots { // emptyBallotRoots contains the roots of Ballot trees of five leaf diff --git a/contracts/templates/MerkleZeros.sol.template b/contracts/templates/MerkleZeros.sol.template index 6e7d0114f0..0cc463c8f0 100644 --- a/contracts/templates/MerkleZeros.sol.template +++ b/contracts/templates/MerkleZeros.sol.template @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.10; +pragma solidity ^0.8.20; abstract contract MerkleZeros { uint256[<% NUM_ZEROS %>] internal zeros; diff --git a/contracts/tests/EASGatekeeper.test.ts b/contracts/tests/EASGatekeeper.test.ts index a8448f52ab..74e453fa26 100644 --- a/contracts/tests/EASGatekeeper.test.ts +++ b/contracts/tests/EASGatekeeper.test.ts @@ -101,8 +101,9 @@ describe("EAS Gatekeeper", () => { it("should fail to set MACI instance when the caller is not the owner", async () => { const [, secondSigner] = await getSigners(); - await expect(easGatekeeper.connect(secondSigner).setMaciInstance(signerAddress)).to.be.revertedWith( - "Ownable: caller is not the owner", + await expect(easGatekeeper.connect(secondSigner).setMaciInstance(signerAddress)).to.be.revertedWithCustomError( + easGatekeeper, + "OwnableUnauthorizedAccount", ); }); diff --git a/contracts/tests/HatsGatekeeper.test.ts b/contracts/tests/HatsGatekeeper.test.ts index 049f188981..0c55ac260a 100644 --- a/contracts/tests/HatsGatekeeper.test.ts +++ b/contracts/tests/HatsGatekeeper.test.ts @@ -150,8 +150,9 @@ describe("HatsProtocol Gatekeeper", () => { }); it("should fail to set MACI instance when the caller is not the owner", async () => { - await expect(hatsGatekeeperSingle.connect(voter).setMaciInstance(signerAddress)).to.be.revertedWith( - "Ownable: caller is not the owner", + await expect(hatsGatekeeperSingle.connect(voter).setMaciInstance(signerAddress)).to.be.revertedWithCustomError( + hatsGatekeeperSingle, + "OwnableUnauthorizedAccount", ); }); }); @@ -252,9 +253,9 @@ describe("HatsProtocol Gatekeeper", () => { }); it("should fail to set MACI instance when the caller is not the owner", async () => { - await expect(hatsGatekeeperMultiple.connect(voter).setMaciInstance(signerAddress)).to.be.revertedWith( - "Ownable: caller is not the owner", - ); + await expect( + hatsGatekeeperMultiple.connect(voter).setMaciInstance(signerAddress), + ).to.be.revertedWithCustomError(hatsGatekeeperMultiple, "OwnableUnauthorizedAccount"); }); }); diff --git a/contracts/tests/Poll.test.ts b/contracts/tests/Poll.test.ts index 97e9ac334e..1a7c36630e 100644 --- a/contracts/tests/Poll.test.ts +++ b/contracts/tests/Poll.test.ts @@ -11,9 +11,10 @@ import { getDefaultSigner, getSigners } from "../ts/utils"; import { AccQueue, AccQueueQuinaryMaci__factory as AccQueueQuinaryMaciFactory, + Poll__factory as PollFactory, + IERC20Errors__factory as IERC20ErrorsFactory, MACI, Poll as PollContract, - Poll__factory as PollFactory, TopupCredit, Verifier, VkRegistry, @@ -162,7 +163,12 @@ describe("Poll", () => { }); it("should throw when the user does not have enough tokens", async () => { - await expect(pollContract.connect(signer).topup(1n, 50n)).to.be.revertedWith("ERC20: insufficient allowance"); + const pollAddress = await pollContract.getAddress(); + + await expect(pollContract.connect(signer).topup(1n, 50n)).to.be.revertedWithCustomError( + IERC20ErrorsFactory.connect(pollAddress), + "ERC20InsufficientAllowance", + ); }); it("should emit an event when publishing a topup message", async () => { diff --git a/integrationTests/hardhat.config.ts b/integrationTests/hardhat.config.ts index f9fca4b4c0..3562d475d2 100644 --- a/integrationTests/hardhat.config.ts +++ b/integrationTests/hardhat.config.ts @@ -19,7 +19,7 @@ const config: HardhatUserConfig = { }, }, solidity: { - version: "0.8.10", + version: "0.8.20", settings: { optimizer: { enabled: true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c96e0660c..3dc8814dea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -230,8 +230,8 @@ importers: specifier: ^5.0.0 version: 5.0.0(@nomicfoundation/hardhat-chai-matchers@2.0.6)(@nomicfoundation/hardhat-ethers@3.0.5)(@nomicfoundation/hardhat-ignition-ethers@0.15.1)(@nomicfoundation/hardhat-network-helpers@1.0.10)(@nomicfoundation/hardhat-verify@2.0.5)(@typechain/ethers-v6@0.5.1)(@typechain/hardhat@9.1.0)(@types/chai@4.3.14)(@types/mocha@10.0.6)(@types/node@20.12.7)(chai@4.4.1)(ethers@6.11.1)(hardhat-gas-reporter@1.0.10)(hardhat@2.22.2)(solidity-coverage@0.8.12)(ts-node@10.9.2)(typechain@8.3.2)(typescript@5.4.5) '@openzeppelin/contracts': - specifier: ^4.8.0 - version: 4.9.6 + specifier: ^5.0.2 + version: 5.0.2 circomlibjs: specifier: ^0.1.7 version: 0.1.7 @@ -4612,8 +4612,8 @@ packages: '@octokit/openapi-types': 18.1.1 dev: true - /@openzeppelin/contracts@4.9.6: - resolution: {integrity: sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA==} + /@openzeppelin/contracts@5.0.2: + resolution: {integrity: sha512-ytPc6eLGcHHnapAZ9S+5qsdomhjo6QBHTDRRBFfTxXIpsicMhVPouPgmUPebZZZGX7vt9USA+Z+0M0dSVtSUEA==} dev: false /@pkgjs/parseargs@0.11.0: