Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kelemeno committed Jun 6, 2024
1 parent a6f82a3 commit ebf3a1e
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 434 deletions.
17 changes: 4 additions & 13 deletions l1-contracts/scripts/governance-accept-ownership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function main() {
await transferOwnership1StepTo(deployWallet, stmAddr, ownerAddress, true);
await transferOwnership1StepTo(deployWallet, l1SharedBridgeAddr, ownerAddress, true);
await transferOwnership1StepTo(deployWallet, bridgehubAddr, ownerAddress, true);
// await transferOwnership1StepTo(deployWallet, proxyAdminAddr, ownerAddress, false);
await transferOwnership1StepTo(deployWallet, proxyAdminAddr, ownerAddress, false);
});

program
Expand Down Expand Up @@ -138,8 +138,8 @@ async function main() {
const bridgehubAddr = ethers.utils.getAddress(cmd.bridgehubAddr);
console.log("Using Bridgehub address: ", bridgehubAddr);

await transferAdmin1StepTo(deployWallet, stmAddr, ownerAddress, true);
await transferAdmin1StepTo(deployWallet, bridgehubAddr, ownerAddress, true);
await transferAdmin1StepTo(deployWallet, stmAddr, ownerAddress);
await transferAdmin1StepTo(deployWallet, bridgehubAddr, ownerAddress);
});

program
Expand Down Expand Up @@ -205,22 +205,13 @@ function acceptOwnershipCall(target: string) {
};
}

async function transferAdmin1StepTo(
wallet: ethers.Wallet,
contractAddress: string,
newOwner: string,
printPendingOwner: boolean = true
) {
async function transferAdmin1StepTo(wallet: ethers.Wallet, contractAddress: string, newOwner: string) {
const l1Erc20ABI = ["function setPendingAdmin(address to)"];
const contract = new ethers.Contract(contractAddress, l1Erc20ABI, wallet);
console.log("Transferring admin of contract: ", contractAddress, " to: ", newOwner);
const tx = await contract.setPendingAdmin(newOwner);
console.log("Tx hash", tx.hash);
await tx.wait();
// if (printPendingOwner) {
// const newPendingOwner = await contract.pendingAdmin();
// console.log("New pending owner: ", newPendingOwner);
// }
}

function acceptAdminCall(target: string) {
Expand Down
2 changes: 1 addition & 1 deletion l1-contracts/scripts/upgrade-consistency-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const legacyBridgeImpl = process.env.CONTRACTS_L1_ERC20_BRIDGE_IMPL_ADDR!;

const expectedL1WethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const initialOwner = "0x71d84c3404a6ae258E6471d4934B96a2033F9438";
const expectedOwner = "0x71d84c3404a6ae258E6471d4934B96a2033F9438" //process.env.CONTRACTS_GOVERNANCE_ADDR!;
const expectedOwner = "0x71d84c3404a6ae258E6471d4934B96a2033F9438"; //process.env.CONTRACTS_GOVERNANCE_ADDR!;
const expectedDelay = "75600";
const eraChainId = process.env.CONTRACTS_ERA_CHAIN_ID!;
const expectedSalt = "0x0000000000000000000000000000000000000000000000000000000000000001";
Expand Down
85 changes: 15 additions & 70 deletions l1-contracts/scripts/verify.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// hardhat import should be the first import in the file
import * as hardhat from "hardhat";
import { deployedAddressesFromEnv } from "../src.ts/deploy-utils";
// import { getNumberFromEnv, getHashFromEnv, getAddressFromEnv } from "../src.ts/utils";
// import { getNumberFromEnv, getHashFromEnv, getAddressFromEnv} from "../src.ts/utils";
import { ethTestConfig } from "../src.ts/utils";

// import { Interface } from "ethers/lib/utils";
import { Deployer } from "../src.ts/deploy";
import { Wallet } from "ethers";
import { packSemver, unpackStringSemVer, web3Provider } from "./utils";
import { getTokens } from "../src.ts/deploy-token";
// import { packSemver, unpackStringSemVer, } from "./utils";
import { web3Provider } from "./utils";
// import { getTokens } from "../src.ts/deploy-token";

const provider = web3Provider();

Expand Down Expand Up @@ -49,7 +50,7 @@ async function main() {
ownerAddress: deployWalletAddress,
verbose: true,
});
console.log(deployer);
// console.log(deployer);
// TODO: Restore after switching to hardhat tasks (SMA-1711).
// promises.push(verifyPromise(addresses.AllowList, [governor]));

Expand All @@ -75,10 +76,12 @@ async function main() {
// const promise2 = verifyPromise(addresses.ValidatorTimeLock, [deployWalletAddress, executionDelay, eraChainId]);
// promises.push(promise2);

// console.log("CONTRACTS_HYPERCHAIN_UPGRADE_ADDR", process.env.CONTRACTS_HYPERCHAIN_UPGRADE_ADDR);
// const promise3 = verifyPromise(process.env.CONTRACTS_DEFAULT_UPGRADE_ADDR);
// promises.push(promise3);

// const promise4 = verifyPromise(process.env.CONTRACTS_HYPERCHAIN_UPGRADE_ADDR);
// promises.push(promise4);

// const promise5 = verifyPromise(addresses.TransparentProxyAdmin);
// promises.push(promise5);

Expand Down Expand Up @@ -130,11 +133,13 @@ async function main() {
// {
// owner: addresses.Governance,
// validatorTimelock: addresses.ValidatorTimeLock,
// genesisUpgrade: addresses.StateTransition.GenesisUpgrade,
// genesisBatchHash,
// genesisIndexRepeatedStorageChanges: genesisRollupLeafIndex,
// genesisBatchCommitment,
// diamondCut,
// chainCreationParams: {
// genesisUpgrade: addresses.StateTransition.GenesisUpgrade,
// genesisBatchHash,
// genesisIndexRepeatedStorageChanges: genesisRollupLeafIndex,
// genesisBatchCommitment,
// diamondCut
// },
// protocolVersion,
// },
// ]);
Expand All @@ -157,66 +162,6 @@ async function main() {
// ]);
// promises.push(promise9);

// // // bridges
// // // Note: do this manually and pass in to verify:verify the following: contract:"contracts/bridge/L1ERC20Bridge.sol:L1ERC20Bridge"
// const promise10 = verifyPromise(addresses.Bridges.ERC20BridgeImplementation, [addresses.Bridges.SharedBridgeProxy]);
// promises.push(promise10);

// const eraDiamondProxy = getAddressFromEnv("CONTRACTS_ERA_DIAMOND_PROXY_ADDR");
// const tokens = getTokens();
// const l1WethToken = tokens.find((token: { symbol: string }) => token.symbol == "WETH")!.address;

// const promise12 = verifyPromise(addresses.Bridges.SharedBridgeImplementation, [
// l1WethToken,
// addresses.Bridgehub.BridgehubProxy,
// eraChainId,
// eraDiamondProxy,
// ]);
// promises.push(promise12);
// const initCalldata4 = new Interface(hardhat.artifacts.readArtifactSync("L1SharedBridge").abi).encodeFunctionData(
// "initialize",
// [deployWalletAddress]
// );
// const promise13 = verifyPromise(addresses.Bridges.SharedBridgeProxy, [
// addresses.Bridges.SharedBridgeImplementation,
// addresses.TransparentProxyAdmin,
// initCalldata4,
// ]);
// promises.push(promise13);

// const promise8 = verifyPromise(addresses.StateTransition.StateTransitionImplementation, [
// addresses.Bridgehub.BridgehubProxy,
// getNumberFromEnv("CONTRACTS_MAX_NUMBER_OF_HYPERCHAINS"),
// ]);
// promises.push(promise8);

// const stateTransitionManager = new Interface(hardhat.artifacts.readArtifactSync("StateTransitionManager").abi);
// const genesisBatchHash = getHashFromEnv("CONTRACTS_GENESIS_ROOT"); // TODO: confusing name
// const genesisRollupLeafIndex = getNumberFromEnv("CONTRACTS_GENESIS_ROLLUP_LEAF_INDEX");
// const genesisBatchCommitment = getHashFromEnv("CONTRACTS_GENESIS_BATCH_COMMITMENT");
// const diamondCut = await deployer.initialZkSyncHyperchainDiamondCut([]);
// const protocolVersion = getNumberFromEnv("CONTRACTS_GENESIS_PROTOCOL_VERSION");

// const initCalldata2 = stateTransitionManager.encodeFunctionData("initialize", [
// {
// owner: addresses.Governance,
// validatorTimelock: addresses.ValidatorTimeLock,
// genesisUpgrade: addresses.StateTransition.GenesisUpgrade,
// genesisBatchHash,
// genesisIndexRepeatedStorageChanges: genesisRollupLeafIndex,
// genesisBatchCommitment,
// diamondCut,
// protocolVersion,
// },
// ]);

// const promise9 = verifyPromise(addresses.StateTransition.StateTransitionProxy, [
// addresses.StateTransition.StateTransitionImplementation,
// addresses.TransparentProxyAdmin,
// initCalldata2,
// ]);
// promises.push(promise9);

// // bridges
// // Note: do this manually and pass in to verify:verify the following: contract:"contracts/bridge/L1ERC20Bridge.sol:L1ERC20Bridge"
// const promise10 = verifyPromise(addresses.Bridges.ERC20BridgeImplementation, [addresses.Bridges.SharedBridgeProxy]);
Expand Down
Loading

0 comments on commit ebf3a1e

Please sign in to comment.