diff --git a/ethereum/scripts/deploy.ts b/ethereum/scripts/deploy.ts index d199a639c..0f3ed17a3 100644 --- a/ethereum/scripts/deploy.ts +++ b/ethereum/scripts/deploy.ts @@ -53,11 +53,14 @@ async function main() { await deployer.deployCreate2Factory({ gasPrice, nonce }); nonce++; } - + // Deploy diamond upgrade init contract if needed const diamondUpgradeContractVersion = cmd.diamondUpgradeInit; if (diamondUpgradeContractVersion) { - await deployer.deployDiamondUpgradeInit(create2Salt, diamondUpgradeContractVersion, { gasPrice, nonce }); + await deployer.deployDiamondUpgradeInit(create2Salt, diamondUpgradeContractVersion, { + gasPrice, + nonce + }); nonce++; } diff --git a/ethereum/scripts/diamond-upgrade.ts b/ethereum/scripts/diamond-upgrade.ts index 5866c4a23..c555ee0fe 100644 --- a/ethereum/scripts/diamond-upgrade.ts +++ b/ethereum/scripts/diamond-upgrade.ts @@ -35,7 +35,8 @@ async function main() { print('Facets', facets); }); - program.command('legacy-prepare-upgrade-calldata ') + program + .command('legacy-prepare-upgrade-calldata ') .option('--init-address ') .option('--init-data ') .action(async (facetCutsData: string, cmd) => { diff --git a/ethereum/scripts/upgrades/upgrade-3.ts b/ethereum/scripts/upgrades/upgrade-3.ts index 51c53738c..67b23b1c1 100644 --- a/ethereum/scripts/upgrades/upgrade-3.ts +++ b/ethereum/scripts/upgrades/upgrade-3.ts @@ -18,7 +18,7 @@ async function prepareCalldata( diamondUpgradeAddress: string, allowlist: string, verifier: string, - prioirityTxMaxErgsLimit: string, + prioirityTxMaxErgsLimit: string ) { const DiamondUpgradeInit3 = await ethers.getContractAt('DiamondUpgradeInit3', ZERO_ADDRESS); @@ -26,7 +26,7 @@ async function prepareCalldata( const upgradeInitData = await DiamondUpgradeInit3.interface.encodeFunctionData('upgrade', [ allowlist, verifier, - prioirityTxMaxErgsLimit, + prioirityTxMaxErgsLimit ]); return diamondCut([], diamondUpgradeAddress, upgradeInitData); @@ -85,7 +85,7 @@ async function main() { governorAddress: ZERO_ADDRESS, verbose: true }); - + const zkSyncContract = IOldDiamondCutFactory.connect(deployer.addresses.ZkSync.DiamondProxy, deployWallet); // Get address of the diamond init contract @@ -97,8 +97,13 @@ async function main() { // Get the prioirity tx max ergs limit const prioirityTxMaxErgsLimit = cmd.prioirityTxMaxErgsLimit; // Get diamond cut data - const upgradeParam = await prepareCalldata(diamondUpgradeAddress, allowlist, verifier, prioirityTxMaxErgsLimit); - + const upgradeParam = await prepareCalldata( + diamondUpgradeAddress, + allowlist, + verifier, + prioirityTxMaxErgsLimit + ); + const proposeUpgradeTx = await zkSyncContract.proposeDiamondCut( upgradeParam.facetCuts, upgradeParam.initAddress diff --git a/ethereum/scripts/upgrades/upgrade-4.ts b/ethereum/scripts/upgrades/upgrade-4.ts index 9cbfc38ec..072851aa9 100644 --- a/ethereum/scripts/upgrades/upgrade-4.ts +++ b/ethereum/scripts/upgrades/upgrade-4.ts @@ -34,7 +34,10 @@ async function prepareCalldata( params: Array ) { const DiamondUpgradeInit4 = await ethers.getContractAt('DiamondUpgradeInit4', ZERO_ADDRESS); - const oldDeployerSystemContract = await ethers.getContractAt('cache/solpp-generated-contracts/zksync/upgrade-initializers/DiamondUpgradeInit4.sol:IOldContractDeployer', ZERO_ADDRESS); + const oldDeployerSystemContract = await ethers.getContractAt( + 'cache/solpp-generated-contracts/zksync/upgrade-initializers/DiamondUpgradeInit4.sol:IOldContractDeployer', + ZERO_ADDRESS + ); const newDeployerSystemContract = await ethers.getContractAt('IContractDeployer', ZERO_ADDRESS); const upgradeDeployerParams: ForceDeploymentOld = { @@ -122,12 +125,9 @@ async function main() { const params: Array = JSON.parse(cmd.deploymentParams); // Get diamond cut data const upgradeParam = await prepareCalldata(diamondUpgradeAddress, deployerBytecodeHash, params); - + const proposalId = cmd.proposalId ? cmd.proposalId : await zkSyncContract.getCurrentProposalId(); - const proposeUpgradeTx = await zkSyncContract.proposeTransparentUpgrade( - upgradeParam, - proposalId - ); + const proposeUpgradeTx = await zkSyncContract.proposeTransparentUpgrade(upgradeParam, proposalId); await proposeUpgradeTx.wait(); const executeUpgradeTx = await zkSyncContract.executeUpgrade(upgradeParam, ethers.constants.HashZero); diff --git a/ethereum/src.ts/deploy.ts b/ethereum/src.ts/deploy.ts index 680a260f1..5000f97da 100644 --- a/ethereum/src.ts/deploy.ts +++ b/ethereum/src.ts/deploy.ts @@ -373,9 +373,18 @@ export class Deployer { this.addresses.ZkSync.DiamondInit = contractAddress; } - public async deployDiamondUpgradeInit(create2Salt: string, contractVersion: number, ethTxOptions: ethers.providers.TransactionRequest) { + public async deployDiamondUpgradeInit( + create2Salt: string, + contractVersion: number, + ethTxOptions: ethers.providers.TransactionRequest + ) { ethTxOptions.gasLimit ??= 10_000_000; - const contractAddress = await this.deployViaCreate2(`DiamondUpgradeInit${contractVersion}`, [], create2Salt, ethTxOptions); + const contractAddress = await this.deployViaCreate2( + `DiamondUpgradeInit${contractVersion}`, + [], + create2Salt, + ethTxOptions + ); if (this.verbose) { console.log(`CONTRACTS_DIAMOND_UPGRADE_INIT_ADDR=${contractAddress}`); @@ -414,7 +423,7 @@ export class Deployer { this.deployGovernanceFacet(create2Salt, { gasPrice, nonce: nonce + 3 }), this.deployGettersFacet(create2Salt, { gasPrice, nonce: nonce + 4 }), this.deployVerifier(create2Salt, { gasPrice, nonce: nonce + 5 }), - this.deployDiamondInit(create2Salt, { gasPrice, nonce: nonce + 6 }), + this.deployDiamondInit(create2Salt, { gasPrice, nonce: nonce + 6 }) ]; await Promise.all(independentZkSyncDeployPromises); nonce += 8; diff --git a/zksync/src/publish-bridge-preimages.ts b/zksync/src/publish-bridge-preimages.ts index 1161f2a5b..4f3345a60 100644 --- a/zksync/src/publish-bridge-preimages.ts +++ b/zksync/src/publish-bridge-preimages.ts @@ -41,11 +41,25 @@ async function main() { const deployer = new Deployer({ deployWallet: wallet }); const zkSync = deployer.zkSyncContract(wallet); - - const publishL2EthBridgeTx = await zkSync.requestL2Transaction(ethers.constants.AddressZero, 0, "0x", PRIORITY_TX_MAX_ERGS_LIMIT, [getContractBytecode("L2ETHBridge")], {nonce, gasPrice}); + + const publishL2EthBridgeTx = await zkSync.requestL2Transaction( + ethers.constants.AddressZero, + 0, + '0x', + PRIORITY_TX_MAX_ERGS_LIMIT, + [getContractBytecode('L2ETHBridge')], + { nonce, gasPrice } + ); await publishL2EthBridgeTx.wait(); - const publishL2ERC20BridgeTx = await zkSync.requestL2Transaction(ethers.constants.AddressZero, 0, "0x", PRIORITY_TX_MAX_ERGS_LIMIT, [getContractBytecode("L2ERC20Bridge")], {nonce: nonce+1, gasPrice}); + const publishL2ERC20BridgeTx = await zkSync.requestL2Transaction( + ethers.constants.AddressZero, + 0, + '0x', + PRIORITY_TX_MAX_ERGS_LIMIT, + [getContractBytecode('L2ERC20Bridge')], + { nonce: nonce + 1, gasPrice } + ); await publishL2ERC20BridgeTx.wait(); });