From bd4af7ef8f4b18ea3a032f727241ff2117cbaeee Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Wed, 29 May 2024 15:03:05 +0200 Subject: [PATCH 1/4] use governance as hyperchain governor --- l1-contracts/src.ts/deploy.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/l1-contracts/src.ts/deploy.ts b/l1-contracts/src.ts/deploy.ts index 5373fd352..e8128303e 100644 --- a/l1-contracts/src.ts/deploy.ts +++ b/l1-contracts/src.ts/deploy.ts @@ -812,6 +812,30 @@ export class Deployer { console.log(`Validium mode set, gas used: ${receipt5.gasUsed.toString()}`); } } + + await this.transferAdminFromDeployerToGovernance(); + } + + public async transferAdminFromDeployerToGovernance() { + const stm = this.stateTransitionManagerContract(this.deployWallet); + const diamondProxyAddress = await stm.getHyperchain(this.chainId); + const hyperchain = IZkSyncHyperchainFactory.connect(diamondProxyAddress, this.deployWallet); + + const receipt = await (await hyperchain.setPendingAdmin(this.addresses.Governance)).wait(); + if (this.verbose) { + console.log(`Governance set as pending admin, gas used: ${receipt.gasUsed.toString()}`); + } + + await this.executeUpgrade( + hyperchain.address, + 0, + hyperchain.interface.encodeFunctionData("acceptAdmin"), + false + ); + + if (this.verbose) { + console.log(`Pending admin successfully accepted`); + } } public async registerToken(tokenAddress: string, useGovernance: boolean = false) { From bcabb20d5a28361f20567864284da63b94f0ecc5 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Wed, 29 May 2024 15:04:54 +0200 Subject: [PATCH 2/4] fmt --- l1-contracts/src.ts/deploy.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/l1-contracts/src.ts/deploy.ts b/l1-contracts/src.ts/deploy.ts index e8128303e..9e633e4cc 100644 --- a/l1-contracts/src.ts/deploy.ts +++ b/l1-contracts/src.ts/deploy.ts @@ -820,18 +820,13 @@ export class Deployer { const stm = this.stateTransitionManagerContract(this.deployWallet); const diamondProxyAddress = await stm.getHyperchain(this.chainId); const hyperchain = IZkSyncHyperchainFactory.connect(diamondProxyAddress, this.deployWallet); - + const receipt = await (await hyperchain.setPendingAdmin(this.addresses.Governance)).wait(); if (this.verbose) { console.log(`Governance set as pending admin, gas used: ${receipt.gasUsed.toString()}`); } - await this.executeUpgrade( - hyperchain.address, - 0, - hyperchain.interface.encodeFunctionData("acceptAdmin"), - false - ); + await this.executeUpgrade(hyperchain.address, 0, hyperchain.interface.encodeFunctionData("acceptAdmin"), false); if (this.verbose) { console.log(`Pending admin successfully accepted`); From dffd1bcf4a9b8fa9875e1857a01ccdbd3771b9f8 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Wed, 29 May 2024 15:08:21 +0200 Subject: [PATCH 3/4] fmt --- l1-contracts/src.ts/deploy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/l1-contracts/src.ts/deploy.ts b/l1-contracts/src.ts/deploy.ts index 9e633e4cc..6eccaaba2 100644 --- a/l1-contracts/src.ts/deploy.ts +++ b/l1-contracts/src.ts/deploy.ts @@ -829,7 +829,7 @@ export class Deployer { await this.executeUpgrade(hyperchain.address, 0, hyperchain.interface.encodeFunctionData("acceptAdmin"), false); if (this.verbose) { - console.log(`Pending admin successfully accepted`); + console.log("Pending admin successfully accepted"); } } From bfa4f4bea718cb73e4f1e13b5b80381bf4645385 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Thu, 30 May 2024 12:59:15 +0200 Subject: [PATCH 4/4] make more compatible with old unit tests --- l1-contracts/scripts/register-hyperchain.ts | 1 + l1-contracts/src.ts/deploy.ts | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/l1-contracts/scripts/register-hyperchain.ts b/l1-contracts/scripts/register-hyperchain.ts index d516f03c1..755352f9b 100644 --- a/l1-contracts/scripts/register-hyperchain.ts +++ b/l1-contracts/scripts/register-hyperchain.ts @@ -107,6 +107,7 @@ async function main() { } await deployer.registerHyperchain(baseTokenAddress, cmd.validiumMode, null, gasPrice, useGovernance); + await deployer.transferAdminFromDeployerToGovernance(); }); await program.parseAsync(process.argv); diff --git a/l1-contracts/src.ts/deploy.ts b/l1-contracts/src.ts/deploy.ts index aff5c65e5..77dfba303 100644 --- a/l1-contracts/src.ts/deploy.ts +++ b/l1-contracts/src.ts/deploy.ts @@ -818,8 +818,6 @@ export class Deployer { console.log(`Validium mode set, gas used: ${receipt5.gasUsed.toString()}`); } } - - await this.transferAdminFromDeployerToGovernance(); } public async transferAdminFromDeployerToGovernance() {