Skip to content

Commit

Permalink
Merge pull request #150 from 0xPolygonHermez/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
krlosMata authored Nov 21, 2023
2 parents aa46080 + 3235aeb commit 53e95f3
Show file tree
Hide file tree
Showing 10 changed files with 568 additions and 1,590 deletions.
4 changes: 2 additions & 2 deletions compiled-contracts/FflonkVerifier.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion contracts/mainnetUpgraded/PolygonZkEVMUpgraded.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "../PolygonZkEVM.sol";

/**
* Contract responsible for managing the state and the updates of the L2 network
* This contract will NOT BE USED IN PRODUCTION, will be used only in testnet enviroment
*/
contract PolygonZkEVMUpgraded is PolygonZkEVM {
// Indicates the last version before upgrade
Expand Down
4 changes: 2 additions & 2 deletions contracts/verifiers/FflonkVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ contract FflonkVerifier {
uint256 constant w8_7 = 8613538655231327379234925296132678673308827349856085326283699237864372525723;

// Verifier preprocessed input C_0(x)·[1]_1
uint256 constant C0x = 10330861150616913541207360924312278787207684679419670167996002791305440821704;
uint256 constant C0y = 14244524222232642134204580826860575549922689127759263461569792153452315036880;
uint256 constant C0x = 7436841426934271843999872946312645822871802402068881571108027575346498207286;
uint256 constant C0y = 18448034242258174646222819724328439025708531082946938915005051387020977719791;

// Verifier preprocessed input x·[1]_2
uint256 constant X2x1 = 21831381940315734285607113342023901060522397560371972897001948545212302161822;
Expand Down
1 change: 1 addition & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module.exports = {
enabled: true,
runs: 999999,
},
evmVersion: "shanghai",
},
},
{
Expand Down
2,073 changes: 490 additions & 1,583 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@0xpolygonhermez/zkevm-contracts",
"description": "Core contracts for the Polygon Hermez zkEVM",
"version": "2.0.0",
"version": "3.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/0xPolygonHermez/contracts-zkEVM.git"
Expand Down Expand Up @@ -34,7 +34,7 @@
"ethers": "^5.7.2"
},
"devDependencies": {
"@0xpolygonhermez/zkevm-commonjs": "github:0xPolygonHermez/zkevm-commonjs#v2.0.0-fork.5",
"@0xpolygonhermez/zkevm-commonjs": "github:0xPolygonHermez/zkevm-commonjs#v3.0.0-fork.6",
"@nomiclabs/hardhat-ethers": "^2.2.2",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-waffle": "^2.0.5",
Expand Down
1 change: 1 addition & 0 deletions upgrade/tool-regen-upgrade-info/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
input.json
33 changes: 33 additions & 0 deletions upgrade/tool-regen-upgrade-info/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Regenerate upgrade info

## pre-requisites
- move to the commit where the last upgrade has been done
- delete folder `artifacts` and `cache` folder

## set project root environment variables
- `cp .env.example .env` in root folder and set your own variables

## input variables
- copy input.example.json into your input file and fill in with your parameters:
- `cp upgrade/tool-regen-upgrade-info/input.example.json upgrade/tool-regen-upgrade-info/input.json`

- input parameters:
```
{
"proxyAddress": "0x012345",
"implementationName": "PolygonZkEVMUpgraded",
"constructorArgs": [
"0x6407cf296a27B38fd29c401518504D388F1DFB3d",
"0xF1b13757bcF3EF902a7847f409A6068BA43a89D4",
"0xeDB618947F59FC5caA8bc9c24283807FDdAf6E2c",
"0xcFA773Cc48FBde3CA4D24eeCb19D224d697026b2",
1440,
3
]
}
```

## run the script
- Run the following commands from the root repository:
- command: `npx hardhat run regenerate-upgrade-info.js --network {networkName}`
- output: create `.openzeppelin` folder with `${networkName}.json`
12 changes: 12 additions & 0 deletions upgrade/tool-regen-upgrade-info/input.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"proxyAddress": "0x012345",
"implementationName": "PolygonZkEVMUpgraded",
"constructorArgs": [
"0x6407cf296a27B38fd29c401518504D388F1DFB3d",
"0xF1b13757bcF3EF902a7847f409A6068BA43a89D4",
"0xeDB618947F59FC5caA8bc9c24283807FDdAf6E2c",
"0xcFA773Cc48FBde3CA4D24eeCb19D224d697026b2",
1440,
3
]
}
25 changes: 25 additions & 0 deletions upgrade/tool-regen-upgrade-info/regen-upgrade-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */
const { ethers, upgrades } = require('hardhat');
const path = require('path');
const fs = require('fs');
// require('dotenv').config({ path: path.resolve(__dirname, '../.env') });

async function main() {
// load input file
const input = JSON.parse(fs.readFileSync(path.resolve(__dirname, './input.json')));

// Load implementation contract
const PolygonZkEVMFactory = await ethers.getContractFactory(input.implementationName, ethers.provider);

// Import OZ upgrades
await upgrades.forceImport(input.proxyAddress, PolygonZkEVMFactory, {
kind: 'transparent',
constructorArgs: input.constructorArgs,
});
}

main().catch((e) => {
console.error(e);
process.exit(1);
});

0 comments on commit 53e95f3

Please sign in to comment.