Skip to content

Commit

Permalink
chore(contracts): update @openzeppelin/contracts, solidity compiler v…
Browse files Browse the repository at this point in the history
…ersion and compatibility fixes
  • Loading branch information
0xmad committed Jan 16, 2024
1 parent 760fff9 commit acde537
Show file tree
Hide file tree
Showing 52 changed files with 81 additions and 67 deletions.
4 changes: 2 additions & 2 deletions contracts/contracts/MACI.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -16,7 +16,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, Params, Utilities, Ownable {
contract MACI is IMACI, 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.
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/MessageProcessor.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -16,7 +16,7 @@ import { CommonUtilities } from "./utilities/CommonUtilities.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 {
contract MessageProcessor is Ownable(msg.sender), SnarkCommon, Hasher, CommonUtilities, IMessageProcessor {
/// @notice custom errors
error NoMoreMessages();
error StateAqNotMerged();
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/Poll.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;

bool internal isInit;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/PollFactory.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/SignUpToken.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// 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";

/// @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") {}

Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/Subsidy.sol
Original file line number Diff line number Diff line change
@@ -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 { IMessageProcessor } from "./interfaces/IMessageProcessor.sol";
Expand All @@ -15,7 +15,7 @@ import { IVkRegistry } from "./interfaces/IVkRegistry.sol";
/// @notice This contract is used to verify that the subsidy calculations
/// are correct. It is also used to update the subsidy commitment if the
/// proof is valid.
contract Subsidy is Ownable, CommonUtilities, Hasher, SnarkCommon {
contract Subsidy is Ownable(msg.sender), CommonUtilities, Hasher, SnarkCommon {
// row batch index
uint256 public rbi;
// column batch index
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/Tally.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -14,7 +14,7 @@ import { CommonUtilities } from "./utilities/CommonUtilities.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 {
contract Tally is Ownable(msg.sender), SnarkCommon, CommonUtilities, Hasher {
uint8 private constant TREE_ARITY = 5;

/// @notice The commitment to the tally results. Its initial value is 0, but after
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/TopupCredit.sol
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// 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";

/// @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;

Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/VkRegistry.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -9,7 +9,7 @@ import { IVkRegistry } from "./interfaces/IVkRegistry.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, SnarkCommon, IVkRegistry {
contract VkRegistry is Ownable(msg.sender), SnarkCommon, IVkRegistry {
mapping(uint256 => VerifyingKey) internal processVks;
mapping(uint256 => bool) internal processVkSet;

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/benchmarks/HasherBenchmarks.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { Hasher } from "../crypto/Hasher.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/Hasher.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/MockVerifier.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/Pairing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/PoseidonT3.sol
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/PoseidonT4.sol
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/PoseidonT5.sol
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/PoseidonT6.sol
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/SnarkCommon.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/SnarkConstants.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/crypto/Verifier.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { MACI } from "../MACI.sol";
import { SignUpGatekeeper } from "./SignUpGatekeeper.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/gatekeepers/SignUpGatekeeper.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { MACI } from "../MACI.sol";

Expand Down
6 changes: 3 additions & 3 deletions contracts/contracts/gatekeepers/SignUpTokenGatekeeper.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -11,7 +11,7 @@ import { MACI } from "../MACI.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
Expand All @@ -27,7 +27,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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { InitialVoiceCreditProxy } from "./InitialVoiceCreditProxy.sol";

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/interfaces/IMACI.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { AccQueue } from "../trees/AccQueue.sol";

Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/trees/AccQueue.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueBinary.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { AccQueue } from "./AccQueue.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueBinary0.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueBinaryMaci.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueQuinary.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { AccQueue } from "./AccQueue.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueQuinary0.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueQuinaryBlankSl.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/AccQueueQuinaryMaci.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/EmptyBallotRoots.sol
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/zeros/MerkleBinary0.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/zeros/MerkleBinaryMaci.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/zeros/MerkleQuinary0.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/zeros/MerkleQuinaryBlankSl.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/trees/zeros/MerkleQuinaryMaci.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/utilities/CommonUtilities.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma solidity ^0.8.20;

import { IPoll } from "../interfaces/IPoll.sol";

Expand Down
Loading

0 comments on commit acde537

Please sign in to comment.