Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2687]: Multichain governance on zksync sepolia #384

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hardhat.config.zksync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ task("test", "Update fork config")
.setAction(async function (taskArguments, hre, runSuper) {
const { fork } = taskArguments;

if (hre.network.name === "zkSyncTestNode") {
if (hre.network.name === "zksynctestnode") {
if (!process.env["ZKSYNC_ERA_LOCAL_TEST_NODE"]) {
throw new Error("ZKSYNC_ERA_LOCAL_TEST_NODE env variable is not set");
}
Expand All @@ -61,7 +61,7 @@ task("test", "Update fork config")
allowUnlimitedContractSize: false,
loggingEnabled: false,
forking:
hre.network.name === "zkSyncTestNode"
hre.network.name === "zksynctestnode"
? {
enabled: false,
url: process.env["ZKSYNC_ERA_LOCAL_TEST_NODE"] as string,
Expand Down Expand Up @@ -137,7 +137,7 @@ const config: HardhatUserConfig = {
blockGasLimit: BLOCK_GAS_LIMIT_PER_NETWORK.zksyncmainnet,
zksync: true,
},
zkSyncTestNode: {
zksynctestnode: {
url: process.env.ZKSYNC_ERA_LOCAL_TEST_NODE || "http://localhost:8011",
chainId: 260,
accounts: DEPLOYER_PRIVATE_KEY ? [`0x${DEPLOYER_PRIVATE_KEY}`] : [],
Expand Down
16 changes: 16 additions & 0 deletions multisig/proposals/zksyncsepolia/vip-010/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { makeProposal } from "src/utils";

export const ZKSYNCSEPOLIA_ACM = "0xD07f543d47c3a8997D6079958308e981AC14CD01";
export const ZKSYNCSEPOLIA_NORMAL_TIMELOCK = "0x1730527a0f0930269313D77A317361b42971a67E";
const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000";

export const vip010 = () => {
return makeProposal([
{
target: ZKSYNCSEPOLIA_ACM,
signature: "grantRole(bytes32,address)",
params: [DEFAULT_ADMIN_ROLE, ZKSYNCSEPOLIA_NORMAL_TIMELOCK],
},
]);
};
export default vip010;
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
[
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "account", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "contractAddress", "type": "address" },
{ "indexed": false, "internalType": "string", "name": "functionSig", "type": "string" }
],
"name": "PermissionGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": false, "internalType": "address", "name": "account", "type": "address" },
{ "indexed": false, "internalType": "address", "name": "contractAddress", "type": "address" },
{ "indexed": false, "internalType": "string", "name": "functionSig", "type": "string" }
],
"name": "PermissionRevoked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "indexed": true, "internalType": "bytes32", "name": "previousAdminRole", "type": "bytes32" },
{ "indexed": true, "internalType": "bytes32", "name": "newAdminRole", "type": "bytes32" }
],
"name": "RoleAdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" }
],
"name": "RoleGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{ "indexed": true, "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "indexed": true, "internalType": "address", "name": "account", "type": "address" },
{ "indexed": true, "internalType": "address", "name": "sender", "type": "address" }
],
"name": "RoleRevoked",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_ADMIN_ROLE",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "bytes32", "name": "role", "type": "bytes32" }],
"name": "getRoleAdmin",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "contractAddress", "type": "address" },
{ "internalType": "string", "name": "functionSig", "type": "string" },
{ "internalType": "address", "name": "accountToPermit", "type": "address" }
],
"name": "giveCallPermission",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "grantRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "address", "name": "contractAddress", "type": "address" },
{ "internalType": "string", "name": "functionSig", "type": "string" }
],
"name": "hasPermission",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "hasRole",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "string", "name": "functionSig", "type": "string" }
],
"name": "isAllowedToCall",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "renounceRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "contractAddress", "type": "address" },
{ "internalType": "string", "name": "functionSig", "type": "string" },
{ "internalType": "address", "name": "accountToRevoke", "type": "address" }
],
"name": "revokeCallPermission",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes32", "name": "role", "type": "bytes32" },
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "revokeRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }],
"name": "supportsInterface",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
}
]
31 changes: 31 additions & 0 deletions multisig/simulations/zksyncsepolia/vip-010/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect } from "chai";
import { Contract } from "ethers";
import { ethers } from "hardhat";
import { forking, pretendExecutingVip } from "src/vip-framework";

import vip010, { ZKSYNCSEPOLIA_ACM, ZKSYNCSEPOLIA_NORMAL_TIMELOCK } from "../../../proposals/zksyncsepolia/vip-010";
import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManagerAbi.json";

forking(3771669, async () => {
let acm: Contract;
let defaultAdminRole: string;
before(async () => {
acm = await ethers.getContractAt(ACCESS_CONTROL_MANAGER_ABI, ZKSYNCSEPOLIA_ACM);
defaultAdminRole = await acm.DEFAULT_ADMIN_ROLE();
});
describe("Pre-VIP behaviour", async () => {
it("Normal Timelock does not has default admin role", async () => {
const hasRole = await acm.hasRole(defaultAdminRole, ZKSYNCSEPOLIA_NORMAL_TIMELOCK);
expect(hasRole).equals(false);
});
});
describe("Post-VIP behavior", async () => {
before(async () => {
await pretendExecutingVip(await vip010());
});
it("Normal Timelock has default admin role", async () => {
const hasRole = await acm.hasRole(defaultAdminRole, ZKSYNCSEPOLIA_NORMAL_TIMELOCK);
expect(hasRole).equals(true);
});
});
});
Loading
Loading