Skip to content

Commit

Permalink
verify contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Feb 10, 2023
1 parent 8349fbc commit e6b37c2
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 27 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/Verifier.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions deployment/deployContracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ async function main() {
networkName,
admin,
trustedAggregator,
proxyAdminAddress,
};
fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1));
}
Expand Down
69 changes: 56 additions & 13 deletions deployment/verifyContracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,63 @@ async function main() {
expect(error.message.toLowerCase().includes('already verified')).to.be.equal(true);
}

// verify proxies
const contractNames = ['polygonZkEVMAddress', 'polygonZkEVMBridgeAddress', 'polygonZkEVMGlobalExitRootAddress'];
// verify proxy admin
try {
await hre.run(
'verify:verify',
{
address: deployOutputParameters.proxyAdminAddress,
},
);
} catch (error) {
expect(error.message.toLowerCase().includes('already verified')).to.be.equal(true);
}

// verify zkEVM address
try {
await hre.run(
'verify:verify',
{
address: deployOutputParameters.polygonZkEVMAddress,
constructorArguments: [
deployOutputParameters.polygonZkEVMGlobalExitRootAddress,
deployOutputParameters.maticTokenAddress,
deployOutputParameters.verifierAddress,
deployOutputParameters.polygonZkEVMBridgeAddress,
deployOutputParameters.chainID,
deployOutputParameters.forkID || 0,
],
},
);
} catch (error) {
expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true);
}

for (let i = 0; i < contractNames.length; i++) {
try {
await hre.run(
'verify:verify',
{
address: deployOutputParameters[contractNames[i]],
},
);
} catch (error) {
expect(error.message.toLowerCase().includes('already verified')).to.be.equal(true);
}
// verify global exit root address
try {
await hre.run(
'verify:verify',
{
address: deployOutputParameters.polygonZkEVMGlobalExitRootAddress,
constructorArguments: [
deployOutputParameters.polygonZkEVMAddress,
deployOutputParameters.polygonZkEVMBridgeAddress,
],
},
);
} catch (error) {
expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true);
}

try {
await hre.run(
'verify:verify',
{
address: deployOutputParameters.polygonZkEVMBridgeAddress,
},
);
} catch (error) {
expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true);
}
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
"solidity-docgen": "^0.5.16"
},
"scripts": {
"saveDeployment:goerli": "mkdir -p deployments/goerli_$(date +%s) && cp -r deployment/deploy_*.json deployments/goerli_$(date +%s) && cp .openzeppelin/goerli.json deployments/goerli_$(date +%s)",
"saveDeployment:goerli": "mkdir -p deployments/goerli_$(date +%s) && cp -r deployment/deploy_*.json deployments/goerli_$(date +%s) && cp .openzeppelin/goerli.json deployments/goerli_$(date +%s) && cp genesis.json deployments/goerli_$(date +%s)",
"test": "npx hardhat test test/contracts/**.test.js",
"docgen": "npx solidity-docgen --solc-module solc-0.8 -t ./docs/templates -e ./contracts/verifiers,./contracts/mocks",
"deploy:ZkEVM:hardhat": "npx hardhat run deployment/deployContracts.js --network hardhat",
"deploy:ZkEVM:goerli": "npx hardhat run deployment/deployContracts.js --network goerli && npm run saveDeployment:goerli",
"deploy:ZkEVM:hardhat": "node deployment/createGenesis.js && npx hardhat run deployment/deployContracts.js --network hardhat",
"deploy:ZkEVM:goerli": "node deployment/createGenesis.js && npx hardhat run deployment/deployContracts.js --network goerli && npm run saveDeployment:goerli",
"upgrade:timelock:goerli": "npx hardhat run upgrade/timeLockUpgrade.js --network goerli",
"verify:ZkEVM:goerli": "npx hardhat run deployment/verifyContracts.js --network goerli",
"lint": "npx eslint ./test && npx eslint ./docker/scripts && npx eslint ./deployment && npx eslint ./src",
Expand Down
16 changes: 8 additions & 8 deletions test/contracts/real-prover/test-inputs/proof.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"pi_a": [
"2327622090307511516385842459848668356423537075841640477741513885936484828605",
"16994376655875617948137279512938072753901825871791054332897521837322718218202",
"6833641100435067326212825264737862335236252907613787290372071163995791288253",
"8861302822187805556906176142203023438932421246427555330811382420753396589893",
"1"
],
"pi_b": [
[
"17583190728555046277846744913298088166409384020683094783430857603102711263776",
"6373557693069858928242923229671108214850663769060909150125924412840634664101"
"678063051695155003935721383780430124596226104377536756433661136314698429214",
"5538817173513952585179555584559814262898350398123780358914551673014873218583"
],
[
"7677317068353803146210202095214930255326618550529512577789635073693534959901",
"7199060787009529673972082906143443195326285868953465051359376688510390123540"
"14298164226011600309843264162791503534217263961448111444026359848606467781294",
"4781959152350882824652694188319453097486923795363167999243582030660542699119"
],
[
"1",
"0"
]
],
"pi_c": [
"14077806109317025919041686235433709295750462784941430901647546924637775168528",
"4415429409846688360127756232288891950286850349156171374826700050726681018518",
"21013862216672875701852030531109452454265135009987817312846971397218352825200",
"9698900980970639391995092361333619769837945238344914778429179378875690755459",
"1"
],
"protocol": "groth16"
Expand Down
2 changes: 1 addition & 1 deletion test/contracts/real-prover/test-inputs/public.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
"18432996311612713452031309394730387420849389218459329544791801090500737484823"
"497710763600436484632802628966340843090316637906773936941216815725175090136"
]

0 comments on commit e6b37c2

Please sign in to comment.