From 2a032122ae8e90438a5d25f354fffb8c6e9bf06b Mon Sep 17 00:00:00 2001 From: Alejandro Date: Tue, 18 Jul 2023 03:11:22 +0200 Subject: [PATCH 1/2] fix: multiple typos --- deployment/README.md | 12 ++++++------ docs/testnet/PolygonZkEVMTestnet.md | 4 ++-- docs/testnet/PolygonZkEVMTestnetClearStorage.md | 2 +- docs/testnet/PolygonZkEVMTestnetV2.md | 2 +- src/permit-helper.js | 6 +++--- test/contracts/bridge.test.js | 2 +- test/contracts/bridgeMock.test.js | 2 +- test/contracts/polygonZkEVM.test.js | 12 ++++++------ test/contracts/snark_stark_input.test.js | 2 +- test/contracts/timelockUpgradeTest.js | 6 +++--- upgrade/README.md | 4 ++-- verifyMainnetDeployment/verifyDeployment.md | 8 ++++---- .../verifyMainnetProofVerifier.md | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/deployment/README.md b/deployment/README.md index 19bf1191a..b96ac825c 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -20,7 +20,7 @@ cd deployment cp deploy_parameters.json.example deploy_parameters.json ``` -Fill created `deploy_parameters.json` with appropiate parameters. +Fill created `deploy_parameters.json` with appropriate parameters. See below for more information about the `deploy_parameters.json` The first step is deploying and verifying the `PolygonZkEVMDeployer`, this will be the factory for deterministic contracts, the address of the contracts will depend on the `salt` and the `initialZkEVMDeployerOwner` @@ -51,14 +51,14 @@ To verify contracts use `npm run verify:ZkEVM:${network}` npm run verify:ZkEVM:goerli ``` -A new folder will be created witth the following name `deployments/${network}_$(date +%s)` with all the output information and the OZ proxy information. +A new folder will be created with the following name `deployments/${network}_$(date +%s)` with all the output information and the OZ proxy information. ## deploy-parameters.json - `realVerifier`: bool, Indicates whether deploy a real verifier or not - `trustedSequencerURL`: string, trustedSequencer URL - `networkName`: string, networkName -- `version`:string, will just be emitted at initialization of the contract, usefull just for synchronizer +- `version`:string, will just be emitted at initialization of the contract, useful just for synchronizer - `trustedSequencer`: address, trusted sequencer addresss - `chainID`: uint64, chainID of the zkEVM - `trustedAggregator`:address, Trusted aggregator address @@ -77,12 +77,12 @@ A new folder will be created witth the following name `deployments/${network}_$( ### Optional Parameters - `deployerPvtKey`: string, pvtKey of the deployer, overrides the address in `MNEMONIC` of `.env` if exist -- `maxFeePerGas`:string, Set `maxFeePerGas`, must define aswell `maxPriorityFeePerGas` to use it -- `maxPriorityFeePerGas`:string, Set `maxPriorityFeePerGas`, must define aswell `maxFeePerGas` to use it +- `maxFeePerGas`:string, Set `maxFeePerGas`, must define as well `maxPriorityFeePerGas` to use it +- `maxPriorityFeePerGas`:string, Set `maxPriorityFeePerGas`, must define as well `maxFeePerGas` to use it - `multiplierGas`: number, Gas multiplier with 3 decimals. If `maxFeePerGas` and `maxPriorityFeePerGas` are set, this will not take effect ## Notes - Since there are deterministic address you cannot deploy twice on the same network using the same `salt` and `initialZkEVMDeployerOwner`. Changing one of them is enough to make a new deployment. - It's mandatory to delete the `.openzeppelin` upgradebility information in order to make a new deployment -- `genesis.json` has been generated using the tool: `1_createGenesis`, this script depends on the `deploy_parameters` aswell. +- `genesis.json` has been generated using the tool: `1_createGenesis`, this script depends on the `deploy_parameters` as well. diff --git a/docs/testnet/PolygonZkEVMTestnet.md b/docs/testnet/PolygonZkEVMTestnet.md index 73029150c..18b2857e1 100644 --- a/docs/testnet/PolygonZkEVMTestnet.md +++ b/docs/testnet/PolygonZkEVMTestnet.md @@ -1,5 +1,5 @@ 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 +This contract will NOT BE USED IN PRODUCTION, will be used only in testnet environment ## Functions @@ -72,7 +72,7 @@ Set new forcedBatchTimeout ) public ``` Set new forced batches allowed -Defined as a uint256 because it will be easy to updgrade afterwards +Defined as a uint256 because it will be easy to upgrade afterwards #### Parameters: diff --git a/docs/testnet/PolygonZkEVMTestnetClearStorage.md b/docs/testnet/PolygonZkEVMTestnetClearStorage.md index 4a004aff6..cf2ab9191 100644 --- a/docs/testnet/PolygonZkEVMTestnetClearStorage.md +++ b/docs/testnet/PolygonZkEVMTestnetClearStorage.md @@ -1,5 +1,5 @@ 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 +This contract will NOT BE USED IN PRODUCTION, will be used only in testnet environment ## Functions diff --git a/docs/testnet/PolygonZkEVMTestnetV2.md b/docs/testnet/PolygonZkEVMTestnetV2.md index a742f138d..c8dc41e76 100644 --- a/docs/testnet/PolygonZkEVMTestnetV2.md +++ b/docs/testnet/PolygonZkEVMTestnetV2.md @@ -1,5 +1,5 @@ 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 +This contract will NOT BE USED IN PRODUCTION, will be used only in testnet environment ## Functions diff --git a/src/permit-helper.js b/src/permit-helper.js index 752010f7d..f1e1644e2 100644 --- a/src/permit-helper.js +++ b/src/permit-helper.js @@ -9,7 +9,7 @@ const { expect } = require('chai'); * @param {String} value - Value of the permit * @param {String} nonce - Nonce of the permit * @param {String} deadline - Deadline of the permit - * @returns {Object} - Signature obejct, { v, r, s} + * @returns {Object} - Signature object, { v, r, s} */ async function createPermitSignature(tokenContractInstance, wallet, spenderAddress, value, nonce, deadline, chainId) { const name = await tokenContractInstance.name(); @@ -59,7 +59,7 @@ async function createPermitSignature(tokenContractInstance, wallet, spenderAddre * @param {String} nonce - Nonce of the permit * @param {String} expiry - expiry of the permit * @param {Number} chainId - expiry of the permit - * @returns {Object} - Signature obejct, { v, r, s} + * @returns {Object} - Signature object, { v, r, s} */ async function createPermitSignatureDaiType(tokenContractInstance, wallet, spenderAddress, nonce, expiry, chainId) { const name = await tokenContractInstance.name(); @@ -111,7 +111,7 @@ async function createPermitSignatureDaiType(tokenContractInstance, wallet, spend * @param {String} nonce - Nonce of the permit * @param {String} deadline - Deadline of the permit * @param {Number} chainId - expiry of the permit - * @returns {Object} - Signature obejct, { v, r, s} + * @returns {Object} - Signature object, { v, r, s} */ async function createPermitSignatureUniType(tokenContractInstance, wallet, spenderAddress, value, nonce, deadline, chainId) { const name = await tokenContractInstance.name(); diff --git a/test/contracts/bridge.test.js b/test/contracts/bridge.test.js index a2bbc84a4..b43a6ebc0 100644 --- a/test/contracts/bridge.test.js +++ b/test/contracts/bridge.test.js @@ -613,7 +613,7 @@ describe('PolygonZkEVMBridge Contract', () => { * const height = 32; */ const merkleTreeMainnet = new MerkleTreeBridge(height); - // Imporant calcualte leaf with origin token address no wrapped token address + // Important calculate leaf with origin token address no wrapped token address const originTokenAddress = tokenAddress; const metadataMainnet = '0x'; // since the token does not belong to this network const metadataHashMainnet = ethers.utils.solidityKeccak256(['bytes'], [metadataMainnet]); diff --git a/test/contracts/bridgeMock.test.js b/test/contracts/bridgeMock.test.js index aa1cbb1dd..d55856bd6 100644 --- a/test/contracts/bridgeMock.test.js +++ b/test/contracts/bridgeMock.test.js @@ -130,7 +130,7 @@ describe('PolygonZkEVMBridge Mock Contract', () => { expect(computedGlobalExitRoot).to.be.equal(await polygonZkEVMGlobalExitRoot.getLastGlobalExitRoot()); }); - it('shouldnt be able to PolygonZkEVMBridge more thna 0.25e ehters', async () => { + it('shouldnt be able to PolygonZkEVMBridge more than 0.25e ehters', async () => { // Add a claim leaf to rollup exit tree const tokenAddress = ethers.constants.AddressZero; // ether const amount = ethers.utils.parseEther('10'); diff --git a/test/contracts/polygonZkEVM.test.js b/test/contracts/polygonZkEVM.test.js index 034d04723..320a61d84 100644 --- a/test/contracts/polygonZkEVM.test.js +++ b/test/contracts/polygonZkEVM.test.js @@ -510,7 +510,7 @@ describe('Polygon ZK-EVM', () => { const sequencedBatchData2 = await polygonZkEVMContract.sequencedBatches(2); const batchAccInputHash2 = sequencedBatchData2.accInputHash; - // Calcultate input Hahs for batch 1 + // Calculate input Hahs for batch 1 let batchAccInputHashJs = calculateAccInputHash( ethers.constants.HashZero, calculateBatchHashData(sequence.transactions), @@ -519,7 +519,7 @@ describe('Polygon ZK-EVM', () => { trustedSequencer.address, ); - // Calcultate input Hahs for batch 2 + // Calculate input Hahs for batch 2 batchAccInputHashJs = calculateAccInputHash( batchAccInputHashJs, calculateBatchHashData(sequence2.transactions), @@ -656,7 +656,7 @@ describe('Polygon ZK-EVM', () => { /* * Check batch mapping - * Calcultate input Hahs for batch 1 + * Calculate input Hahs for batch 1 */ let batchAccInputHashJs = calculateAccInputHash( ethers.constants.HashZero, @@ -666,7 +666,7 @@ describe('Polygon ZK-EVM', () => { trustedSequencer.address, ); - // Calcultate input Hahs for batch 2 + // Calculate input Hahs for batch 2 batchAccInputHashJs = calculateAccInputHash( batchAccInputHashJs, calculateBatchHashData(sequence2.transactions), @@ -712,7 +712,7 @@ describe('Polygon ZK-EVM', () => { let currentTimestamp = (await ethers.provider.getBlock()).timestamp; await ethers.provider.send('evm_increaseTime', [1]); // evm_setNextBlockTimestamp - sequence.timestamp = currentTimestamp + 2; // bigger than current block tiemstamp + sequence.timestamp = currentTimestamp + 2; // bigger than current block timestamp // revert because timestamp is more than the current one await expect(polygonZkEVMContract.connect(trustedSequencer).sequenceBatches([sequence], trustedSequencer.address)) @@ -1796,7 +1796,7 @@ describe('Polygon ZK-EVM', () => { await ethers.provider.send('evm_setNextBlockTimestamp', [sequencedTimestmap + haltTimeout]); - // Succesfully acitvate emergency state + // Successfully activate emergency state await expect(polygonZkEVMContract.connect(aggregator1).activateEmergencyState(1)) .to.emit(polygonZkEVMContract, 'EmergencyStateActivated'); }); diff --git a/test/contracts/snark_stark_input.test.js b/test/contracts/snark_stark_input.test.js index 47c404673..b61f957da 100644 --- a/test/contracts/snark_stark_input.test.js +++ b/test/contracts/snark_stark_input.test.js @@ -51,7 +51,7 @@ describe('Polygon ZK-EVM snark stark input test', () => { await polygonZkEVMContract.deployed(); }); - it('Check Accumualte input Hash', async () => { + it('Check Accumulate input Hash', async () => { const oldAccInputHash = '0x0000000000000000000000000000000000000000000000000000000000000000'; const globalExitRoot = '0x090bcaf734c4f06c93954a827b45a6e8c67b8e0fd1e0a35a1c5982d6961828f9'; const timestamp = 1944498031; diff --git a/test/contracts/timelockUpgradeTest.js b/test/contracts/timelockUpgradeTest.js index 752391685..fa1319437 100644 --- a/test/contracts/timelockUpgradeTest.js +++ b/test/contracts/timelockUpgradeTest.js @@ -276,7 +276,7 @@ describe('Polygon ZK-EVM', () => { // Check that is the v0 contract await expect(polygonZkEVMBridgeContractV2.maxEtherBridge()).to.be.reverted; - // Transaction cna be executed, delay is reduced to 0, but fails bc this timelock is not owner + // Transaction can be executed, delay is reduced to 0, but fails bc this timelock is not owner await expect(timelockContract.execute( operation.target, operation.value, @@ -338,7 +338,7 @@ describe('Polygon ZK-EVM', () => { /* * Put zkevmcontract on emergency mode - * Does not affect thsi deployment + * Does not affect this deployment */ await polygonZkEVMContract.activateEmergencyState(0); @@ -367,7 +367,7 @@ describe('Polygon ZK-EVM', () => { // Check that is the v0 contract await expect(polygonZkEVMBridgeContractV2.maxEtherBridge()).to.be.reverted; - // Transaction cna be executed, delay is reduced to 0, but fails bc this timelock is not owner + // Transaction can be executed, delay is reduced to 0, but fails bc this timelock is not owner await expect(timelockContractL2.execute( operation.target, operation.value, diff --git a/upgrade/README.md b/upgrade/README.md index 9e9cd7fa5..573afcccb 100644 --- a/upgrade/README.md +++ b/upgrade/README.md @@ -24,8 +24,8 @@ cd deployment cp upgrade_parameters.json.example upgrade_parameters.json ``` -Fill created `upgrade_parameters.json` with appropiate parameters. -You should fullfill the upgrades array, with all the updates that you intend to do ( more information in `upgrade-parameters.json` section) +Fill created `upgrade_parameters.json` with appropriate parameters. +You should fulfill the upgrades array, with all the updates that you intend to do ( more information in `upgrade-parameters.json` section) if the deployment was deployed without a timelock you can use the `simpleUpgradeScript.js`: diff --git a/verifyMainnetDeployment/verifyDeployment.md b/verifyMainnetDeployment/verifyDeployment.md index 54d55e532..8484fa4f7 100644 --- a/verifyMainnetDeployment/verifyDeployment.md +++ b/verifyMainnetDeployment/verifyDeployment.md @@ -25,8 +25,8 @@ npm i ## Verify deployment -In order to verify the deployment, we will compare the deployed bytecode with the compiled locally. Some of the contracts use [`immutables`](https://docs.soliditylang.org/en/v0.8.19/contracts.html#immutable), in that case it's not enough to just compile the code and compare withthe deployed bytecode. -The easiest way is to verify this contracts is to deploy them on a local enviroment and then compare the bytecodes of this contracts and the mainnet ones. +In order to verify the deployment, we will compare the deployed bytecode with the compiled locally. Some of the contracts use [`immutables`](https://docs.soliditylang.org/en/v0.8.19/contracts.html#immutable), in that case it's not enough to just compile the code and compare with the deployed bytecode. +The easiest way is to verify this contracts is to deploy them on a local environment and then compare the bytecodes of this contracts and the mainnet ones. In order to launch the script, you need a mainnet provider. In root of the project create a `.env` file you Infura api key information: @@ -52,9 +52,9 @@ This script verifies the deployed bytecode of the address provided in `deploymen ## Verify genesis root -At the end of the previous script we also verify that the genesis provided in the`deploymentMainnet.json` matches hte one in the `polygonZkEVM` +At the end of the previous script we also verify that the genesis provided in the`deploymentMainnet.json` matches the one in the `polygonZkEVM` -In order to verify the genesis, you can the script to generate it. The script in a very similar behaviour of the last script, deploy localy the contracts and then copy the deployed btyecode into the corresponding address. +In order to verify the genesis, you can the script to generate it. The script in a very similar behaviour of the last script, deploy locally the contracts and then copy the deployed btyecode into the corresponding address. ```bash= node deployment/1_createGenesis.js --input ../verifyMainnetDeployment/mainnetDeployParameters.json --out ../verifyMainnetDeployment/genesis.json diff --git a/verifyMainnetDeployment/verifyMainnetProofVerifier.md b/verifyMainnetDeployment/verifyMainnetProofVerifier.md index d24baeedf..fd8ceeb26 100644 --- a/verifyMainnetDeployment/verifyMainnetProofVerifier.md +++ b/verifyMainnetDeployment/verifyMainnetProofVerifier.md @@ -13,7 +13,7 @@ sudo apt update sudo apt install -y tmux git curl ```` -## Tweeking the OS to accept high amount of memory. +## Tweaking the OS to accept high amount of memory. ````bash echo "vm.max_map_count=655300" | sudo tee -a /etc/sysctl.conf From c4976ac0c6e20f070d413e24f6773f0fc3fd06a5 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 29 Jan 2024 18:25:09 +0100 Subject: [PATCH 2/2] Removed non-existing files --- deployment/README.md | 88 -------------------------------------------- upgrade/README.md | 54 --------------------------- 2 files changed, 142 deletions(-) delete mode 100644 deployment/README.md delete mode 100644 upgrade/README.md diff --git a/deployment/README.md b/deployment/README.md deleted file mode 100644 index b96ac825c..000000000 --- a/deployment/README.md +++ /dev/null @@ -1,88 +0,0 @@ -## Requirements - -- node version: 14.x -- npm version: 7.x - -## Deployment - -In project root execute: - -``` -npm i -cp .env.example .env -``` - -Fill `.env` with your `MNEMONIC` and `INFURA_PROJECT_ID` -If you want to verify the contracts also fill the `ETHERSCAN_API_KEY` - -``` -cd deployment -cp deploy_parameters.json.example deploy_parameters.json -``` - -Fill created `deploy_parameters.json` with appropriate parameters. -See below for more information about the `deploy_parameters.json` - -The first step is deploying and verifying the `PolygonZkEVMDeployer`, this will be the factory for deterministic contracts, the address of the contracts will depend on the `salt` and the `initialZkEVMDeployerOwner` - -This contrat is deployed using a keyless deployment, therefore the gasPrice is hardcoded. -The value is on `100 gweis`, if it's necessary to update it go to `helpers/deployment-helpers.js` and update the `gasPriceKeylessDeployment` constant. -Note that this operation will change all the deterministic address deployed. - -``` -npm run deploy:deployer:ZkEVM:goerli -npm run verify:deployer:ZkEVM:goerli -``` - -To deploy on testnet is necessary a token MATIC contract, therefore, there's another script that previously to the actual deployment, deploys a matic contracts and adds it automatically to the `deploy_parameters.json` - -To deploy on testnet use:`deploy:testnet:ZkEVM:${network}` - -In other cases use fullfill `maticTokenAddress` in the `deploy_parameters.json` and run `deploy:ZkEVM:${network}` - -``` -npm run deploy:testnet:ZkEVM:goerli - -``` - -To verify contracts use `npm run verify:ZkEVM:${network}` - -``` -npm run verify:ZkEVM:goerli -``` - -A new folder will be created with the following name `deployments/${network}_$(date +%s)` with all the output information and the OZ proxy information. - -## deploy-parameters.json - -- `realVerifier`: bool, Indicates whether deploy a real verifier or not -- `trustedSequencerURL`: string, trustedSequencer URL -- `networkName`: string, networkName -- `version`:string, will just be emitted at initialization of the contract, useful just for synchronizer -- `trustedSequencer`: address, trusted sequencer addresss -- `chainID`: uint64, chainID of the zkEVM -- `trustedAggregator`:address, Trusted aggregator address -- `trustedAggregatorTimeout`: uint64, If a sequence is not verified in this timeout everyone can verify it -- `pendingStateTimeout`: uint64, Once a pending state exceeds this timeout it can be consolidated -- `forkID`: uint64, Fork ID of the zkEVM, indicates the prover (zkROM/executor) version -- `admin`:address, Admin address, can adjust PolygonZkEVM parameters or stop the emergency state -- `zkEVMOwner`: address, Able to put the PolygonZkEVM into emergency state (kill switch) -- `timelockAddress`: address, Timelock owner address, able to send start an upgradability process via timelock -- `minDelayTimelock`: number, Minimum timelock delay, -- `salt`: bytes32, Salt used in `PolygonZkEVMDeployer` to deploy deterministic contracts, such as the PolygonZkEVMBridge -- `initialZkEVMDeployerOwner`: address, Initial owner of the `PolygonZkEVMDeployer` -- `maticTokenAddress`: address, Matic token address, only if deploy on testnet can be left blank and will fullfilled by the scripts. -- `zkEVMDeployerAddress`: address, Address of the `PolygonZkEVMDeployer`. Can be left blank, will be fullfilled automatically with the `deploy:deployer:ZkEVM:goerli` script. - -### Optional Parameters - -- `deployerPvtKey`: string, pvtKey of the deployer, overrides the address in `MNEMONIC` of `.env` if exist -- `maxFeePerGas`:string, Set `maxFeePerGas`, must define as well `maxPriorityFeePerGas` to use it -- `maxPriorityFeePerGas`:string, Set `maxPriorityFeePerGas`, must define as well `maxFeePerGas` to use it -- `multiplierGas`: number, Gas multiplier with 3 decimals. If `maxFeePerGas` and `maxPriorityFeePerGas` are set, this will not take effect - -## Notes - -- Since there are deterministic address you cannot deploy twice on the same network using the same `salt` and `initialZkEVMDeployerOwner`. Changing one of them is enough to make a new deployment. -- It's mandatory to delete the `.openzeppelin` upgradebility information in order to make a new deployment -- `genesis.json` has been generated using the tool: `1_createGenesis`, this script depends on the `deploy_parameters` as well. diff --git a/upgrade/README.md b/upgrade/README.md deleted file mode 100644 index 573afcccb..000000000 --- a/upgrade/README.md +++ /dev/null @@ -1,54 +0,0 @@ -## Requirements - -- node version: 14.x -- npm version: 7.x - -## Upgrade - -``` -npm i -cp .env.example .env -``` - -Fill `.env` with your `MNEMONIC` and `INFURA_PROJECT_ID` - -In order to upgrade the contracts we will need the information on `deployments/${network}_$(date +%s)` - -In project root, copy the `${network}.json` of the deployment that you want to upgrade and copy it on the `./.openzeppelin` -e.g. `cp deployments/${network}_$(date +%s)/${network}.json ./.openzeppelin` - -Then fill the upgrade parameters: - -``` -cd deployment -cp upgrade_parameters.json.example upgrade_parameters.json -``` - -Fill created `upgrade_parameters.json` with appropriate parameters. -You should fulfill the upgrades array, with all the updates that you intend to do ( more information in `upgrade-parameters.json` section) - -if the deployment was deployed without a timelock you can use the `simpleUpgradeScript.js`: - -- Run the script - -Otherwise, in case of timelock use `timeLockUpgrade.js` - -- Run the script -- Now the necessary transactions to interact with the timelock are printed in the screen `schedule` and `execute`, also will be saved in - `./upgrade_output_${new Date().getTime() / 1000}.json` file -- With the owner of the timelock (multisig or account), send the data printed by `schedule` to the `Timelock` contract. -- Once the necessary `timelockMinDelay` has expired, with the same account you can now send the data printed by `execute` to the `Timelock` contract and the contracts will be upgraded. - -## upgrade-parameters.json - -- `timelockMinDelay`: number, timelock delay between the schedule and execution, must be bigger than current min delay -- `upgrades`: Object, Indicates which address and to which implementation must upgrade - - address: address of the current proxy - - contractName: string, contract name that the proxy will be updated to - - constructorArgs: Array, optional, constructor arguments of the new implementation deployed - -### Optional Parameters - -- `multiplierGas`: number, Gas multiplier. If maxFeePerGas and maxPriorityFeePerGas are set, will not take effect -- `deployerPvtKey`: string, deployerPvtKey of the deployer -- `timelockSalt`: string, Optional salt for the timelock