chore: update solidity version

This commit is contained in:
cedoor
2022-01-27 10:45:17 +01:00
parent 7202ea2903
commit 0771ddfc37
10 changed files with 16 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
import {PoseidonT3, PoseidonT6} from "./Poseidon.sol";
import { SnarkConstants } from "./SnarkConstants.sol";

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
import { SnarkConstants } from "./SnarkConstants.sol";
import { Hasher } from "./Hasher.sol";

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
contract Ownable {
address private _owner;

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
library PoseidonT3 {
function poseidon(uint256[2] memory input) public pure returns (uint256) {}

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
import "./Verifier.sol";
import { IncrementalQuinTree } from "./IncrementalMerkleTree.sol";

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
import { Semaphore } from './Semaphore.sol';

View File

@@ -1,5 +1,5 @@
//SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;
pragma solidity ^0.8.4;
contract SnarkConstants {

View File

@@ -6,15 +6,8 @@ import "@nomiclabs/hardhat-ethers"
import "hardhat-deploy"
const hardhatConfig: HardhatUserConfig = {
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
solidity: config.solidity,
paths: config.paths,
networks: {
hardhat: {
chainId: 1337,
@@ -27,8 +20,7 @@ const hardhatConfig: HardhatUserConfig = {
},
namedAccounts: {
deployer: 0
},
paths: config.paths
}
}
export default hardhatConfig

View File

@@ -26,8 +26,7 @@
"compile:circuits": "ts-node scripts/compile-circuits.ts",
"deploy:localhost": "hardhat deploy --tags complete",
"export:localhost": "mkdir -p exports && hardhat --network localhost export --export exports/localhost.json",
"test": "hardhat test",
"test:fullProof": "yarn compile:circuits && yarn test"
"test": "hardhat test"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.4",
@@ -52,6 +51,9 @@
"typescript": "^4.5.5"
},
"config": {
"solidity": {
"version": "0.8.4"
},
"paths": {
"contracts": "./contracts",
"circuit": "./circuit",

View File

@@ -20,6 +20,7 @@ async function exec(command: string) {
async function main() {
const buildPath = config.paths.build.snark
const solidityVersion = config.solidity.version
if (!fs.existsSync(buildPath)) {
fs.mkdirSync(buildPath, { recursive: true })
@@ -59,7 +60,7 @@ async function main() {
{ groth16: fs.readFileSync("./node_modules/snarkjs/templates/verifier_groth16.sol.ejs", "utf8") },
logger
)
verifierCode = verifierCode.replace(/pragma solidity \^\d+\.\d+\.\d+/, "pragma solidity ^0.8.0")
verifierCode = verifierCode.replace(/pragma solidity \^\d+\.\d+\.\d+/, `pragma solidity ^${solidityVersion}`)
fs.writeFileSync(`${buildPath}/verification_key.json`, JSON.stringify(verificationKey), "utf-8")
fs.writeFileSync(`${config.paths.contracts}/Verifier.sol`, verifierCode, "utf-8")