From 94701a45f63d67d5ff421532c4fa8e04a07cce01 Mon Sep 17 00:00:00 2001 From: web3rover Date: Thu, 28 Nov 2024 18:25:18 +0700 Subject: [PATCH 1/5] feat: added vip to revoke permissions --- simulations/vip-385/abi/ACMAggregator.json | 242 ++++++++++++++ .../vip-385/abi/AccessControlManager_ABI.json | 157 +++++++++ .../vip-385/abi/OmnichainProposalSender.json | 314 ++++++++++++++++++ simulations/vip-385/basesepolia.ts | 34 ++ simulations/vip-385/bsctestnet.ts | 26 ++ vips/vip-385/bsctestnet.ts | 44 +++ 6 files changed, 817 insertions(+) create mode 100644 simulations/vip-385/abi/ACMAggregator.json create mode 100644 simulations/vip-385/abi/AccessControlManager_ABI.json create mode 100644 simulations/vip-385/abi/OmnichainProposalSender.json create mode 100644 simulations/vip-385/basesepolia.ts create mode 100644 simulations/vip-385/bsctestnet.ts create mode 100644 vips/vip-385/bsctestnet.ts diff --git a/simulations/vip-385/abi/ACMAggregator.json b/simulations/vip-385/abi/ACMAggregator.json new file mode 100644 index 000000000..6650a3f3c --- /dev/null +++ b/simulations/vip-385/abi/ACMAggregator.json @@ -0,0 +1,242 @@ +[ + { + "inputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "_acm", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "EmptyPermissions", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddressNotAllowed", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "GrantPermissionsAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "GrantPermissionsExecuted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "RevokePermissionsAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "RevokePermissionsExecuted", + "type": "event" + }, + { + "inputs": [], + "name": "ACM", + "outputs": [ + { + "internalType": "contract IAccessControlManagerV8", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "internalType": "struct ACMCommandsAggregator.Permission[]", + "name": "_permissions", + "type": "tuple[]" + } + ], + "name": "addGrantPermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "internalType": "struct ACMCommandsAggregator.Permission[]", + "name": "_permissions", + "type": "tuple[]" + } + ], + "name": "addRevokePermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "executeGrantPermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "executeRevokePermissions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "grantPermissions", + "outputs": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "revokePermissions", + "outputs": [ + { + "internalType": "address", + "name": "contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "functionSig", + "type": "string" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/simulations/vip-385/abi/AccessControlManager_ABI.json b/simulations/vip-385/abi/AccessControlManager_ABI.json new file mode 100644 index 000000000..2ef119947 --- /dev/null +++ b/simulations/vip-385/abi/AccessControlManager_ABI.json @@ -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" + } +] diff --git a/simulations/vip-385/abi/OmnichainProposalSender.json b/simulations/vip-385/abi/OmnichainProposalSender.json new file mode 100644 index 000000000..66fd4df02 --- /dev/null +++ b/simulations/vip-385/abi/OmnichainProposalSender.json @@ -0,0 +1,314 @@ +[ + { + "inputs": [ + { "internalType": "contract ILayerZeroEndpoint", "name": "lzEndpoint_", "type": "address" }, + { "internalType": "address", "name": "accessControlManager_", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { "inputs": [], "name": "ZeroAddressNotAllowed", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "indexed": false, "internalType": "bytes32", "name": "executionHash", "type": "bytes32" } + ], + "name": "ClearPayload", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "indexed": false, "internalType": "bytes", "name": "payload", "type": "bytes" } + ], + "name": "ExecuteRemoteProposal", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "receiver", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "FallbackWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "oldAccessControlManager", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newAccessControlManager", "type": "address" } + ], + "name": "NewAccessControlManager", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }, + { "indexed": false, "internalType": "uint256", "name": "oldMaxLimit", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newMaxLimit", "type": "uint256" } + ], + "name": "SetMaxDailyLimit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "oldRemoteAddress", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "newRemoteAddress", "type": "bytes" } + ], + "name": "SetTrustedRemoteAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "proposalId", "type": "uint256" }, + { "indexed": true, "internalType": "uint16", "name": "remoteChainId", "type": "uint16" }, + { "indexed": false, "internalType": "bytes", "name": "payload", "type": "bytes" }, + { "indexed": false, "internalType": "bytes", "name": "adapterParams", "type": "bytes" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" }, + { "indexed": false, "internalType": "bytes", "name": "reason", "type": "bytes" } + ], + "name": "StorePayload", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": true, "internalType": "uint16", "name": "chainId", "type": "uint16" }], + "name": "TrustedRemoteRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "LZ_ENDPOINT", + "outputs": [{ "internalType": "contract ILayerZeroEndpoint", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accessControlManager", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToLast24HourCommandsSent", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToLast24HourWindowStart", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToLastProposalSentTimestamp", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "chainIdToMaxDailyLimit", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "payload_", "type": "bytes" }, + { "internalType": "bool", "name": "useZro_", "type": "bool" }, + { "internalType": "bytes", "name": "adapterParams_", "type": "bytes" } + ], + "name": "estimateFees", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "payload_", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams_", "type": "bytes" }, + { "internalType": "address", "name": "zroPaymentAddress_", "type": "address" } + ], + "name": "execute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "to_", "type": "address" }, + { "internalType": "uint256", "name": "pId_", "type": "uint256" }, + { "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "payload_", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams_", "type": "bytes" }, + { "internalType": "uint256", "name": "originalValue_", "type": "uint256" } + ], + "name": "fallbackWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "version_", "type": "uint16" }, + { "internalType": "uint16", "name": "chainId_", "type": "uint16" }, + { "internalType": "uint256", "name": "configType_", "type": "uint256" } + ], + "name": "getConfig", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "pause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proposalCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }], + "name": "removeTrustedRemote", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint256", "name": "pId_", "type": "uint256" }, + { "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "payload_", "type": "bytes" }, + { "internalType": "bytes", "name": "adapterParams_", "type": "bytes" }, + { "internalType": "address", "name": "zroPaymentAddress_", "type": "address" }, + { "internalType": "uint256", "name": "originalValue_", "type": "uint256" } + ], + "name": "retryExecute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "accessControlManager_", "type": "address" }], + "name": "setAccessControlManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "version_", "type": "uint16" }, + { "internalType": "uint16", "name": "chainId_", "type": "uint16" }, + { "internalType": "uint256", "name": "configType_", "type": "uint256" }, + { "internalType": "bytes", "name": "config_", "type": "bytes" } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "chainId_", "type": "uint16" }, + { "internalType": "uint256", "name": "limit_", "type": "uint256" } + ], + "name": "setMaxDailyLimit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "version_", "type": "uint16" }], + "name": "setSendVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint16", "name": "remoteChainId_", "type": "uint16" }, + { "internalType": "bytes", "name": "newRemoteAddress_", "type": "bytes" } + ], + "name": "setTrustedRemoteAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "storedExecutionHashes", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], + "name": "trustedRemoteLookup", + "outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "unpause", "outputs": [], "stateMutability": "nonpayable", "type": "function" } +] diff --git a/simulations/vip-385/basesepolia.ts b/simulations/vip-385/basesepolia.ts new file mode 100644 index 000000000..68ed11261 --- /dev/null +++ b/simulations/vip-385/basesepolia.ts @@ -0,0 +1,34 @@ +import { expect } from "chai"; +import { BigNumber, Contract } from "ethers"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { LzChainId } from "src/types"; +import { expectEvents, getOmnichainProposalSenderAddress } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands, testVip } from "src/vip-framework"; + +import vip384 from "../../vips/vip-384/bsctestnet"; +import vip385, { + ACM, + ACM_AGGREGATOR, + DEFAULT_ADMIN_ROLE, +} from "../../vips/vip-385/bsctestnet"; +import ACMAggregator_ABI from "./abi/ACMAggregator.json"; +import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager_ABI.json"; + +forking(18511708, async () => { + testForkedNetworkVipCommands("VIP 385 Multichain Governance - Revoke", await vip385(), { + callbackAfterExecution: async txResponse => { + await expectEvents(txResponse, [ACCESS_CONTROL_MANAGER_ABI], ["PermissionRevoked"], [48]); + await expectEvents(txResponse, [ACMAggregator_ABI], ["RevokePermissionsExecuted"], [1]); + }, + }); + + describe("Post-VIP behaviour", async () => { + const acm = new ethers.Contract(ACM, ACCESS_CONTROL_MANAGER_ABI, ethers.provider); + + it("check if DEFAULT_ROLE has been revoked for ACMAggregator", async () => { + expect(await acm.hasRole(DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR)).to.be.false; + }); + + }); +}); \ No newline at end of file diff --git a/simulations/vip-385/bsctestnet.ts b/simulations/vip-385/bsctestnet.ts new file mode 100644 index 000000000..38a713c16 --- /dev/null +++ b/simulations/vip-385/bsctestnet.ts @@ -0,0 +1,26 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { LzChainId } from "src/types"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testVip } from "src/vip-framework"; + +import vip384 from "../../vips/vip-384/bsctestnet"; +import vip385 from "../../vips/vip-385/bsctestnet"; +import OMNICHAIN_PROPOSAL_SENDER_ABI from "./abi/OmnichainProposalSender.json"; + +const { basesepolia } = NETWORK_ADDRESSES; +forking(46023795, async () => { + testVip("VIP 384 Multichain Governance - Grant Permissions", await vip384(), {}) + + testVip("VIP 385 Multichain Governance - Revoke Permissions", await vip385(), { + callbackAfterExecution: async txResponse => { + await expectEvents( + txResponse, + [OMNICHAIN_PROPOSAL_SENDER_ABI], + ["ExecuteRemoteProposal", "StorePayload"], + [1, 0], + ); + }, + }); +}); \ No newline at end of file diff --git a/vips/vip-385/bsctestnet.ts b/vips/vip-385/bsctestnet.ts new file mode 100644 index 000000000..99732a15d --- /dev/null +++ b/vips/vip-385/bsctestnet.ts @@ -0,0 +1,44 @@ +import { NETWORK_ADDRESSES } from "src/networkAddresses"; +import { LzChainId, ProposalType } from "src/types"; +import { makeProposal } from "src/utils"; + +const { basesepolia } = NETWORK_ADDRESSES; +export const ACM = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; +export const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000"; +export const ACM_AGGREGATOR = "0xd82A217713F6c61f3ed4199cdEEDfbB80e5E4562"; + +const vip389 = () => { + const meta = { + version: "v2", + title: "VIP-389 Enable Multichain Governance on op sepolia", + description: `### Summary`, + forDescription: "I agree that Venus Protocol should proceed with this proposal", + againstDescription: "I do not think that Venus Protocol should proceed with this proposal", + abstainDescription: "I am indifferent to whether Venus Protocol proceeds or not", + }; + return makeProposal( + [ + { + target: ACM, + signature: "grantRole(bytes32,address)", + params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], + dstChainId: LzChainId.basesepolia, + }, + // { + // target: ACM_AGGREGATOR, + // signature: "executeRevokePermissions(uint256)", + // params: [1], + // dstChainId: LzChainId.basesepolia, + // }, + // { + // target: ACM, + // signature: "revokeRole(bytes32,address)", + // params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], + // dstChainId: LzChainId.basesepolia, + // }, + ], + meta, + ProposalType.REGULAR, + ); +}; +export default vip389; From d03062c8b479b49c398d0694654cb79411f5978e Mon Sep 17 00:00:00 2001 From: web3rover Date: Fri, 29 Nov 2024 17:17:13 +0700 Subject: [PATCH 2/5] fix: fixed simulation --- simulations/vip-385/basesepolia.ts | 21 +++++++-------------- simulations/vip-385/bsctestnet.ts | 10 +++------- vips/vip-385/bsctestnet.ts | 26 ++++++++++++-------------- 3 files changed, 22 insertions(+), 35 deletions(-) diff --git a/simulations/vip-385/basesepolia.ts b/simulations/vip-385/basesepolia.ts index 68ed11261..02d22af8b 100644 --- a/simulations/vip-385/basesepolia.ts +++ b/simulations/vip-385/basesepolia.ts @@ -1,24 +1,18 @@ import { expect } from "chai"; -import { BigNumber, Contract } from "ethers"; import { ethers } from "hardhat"; -import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { LzChainId } from "src/types"; -import { expectEvents, getOmnichainProposalSenderAddress } from "src/utils"; -import { forking, pretendExecutingVip, testForkedNetworkVipCommands, testVip } from "src/vip-framework"; +import { expectEvents } from "src/utils"; +import { forking, pretendExecutingVip, testForkedNetworkVipCommands } from "src/vip-framework"; -import vip384 from "../../vips/vip-384/bsctestnet"; -import vip385, { - ACM, - ACM_AGGREGATOR, - DEFAULT_ADMIN_ROLE, -} from "../../vips/vip-385/bsctestnet"; +import vip006 from "../../multisig/proposals/basesepolia/vip-006"; +import vip385, { ACM, ACM_AGGREGATOR, DEFAULT_ADMIN_ROLE } from "../../vips/vip-385/bsctestnet"; import ACMAggregator_ABI from "./abi/ACMAggregator.json"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager_ABI.json"; forking(18511708, async () => { + await pretendExecutingVip(await vip006()); testForkedNetworkVipCommands("VIP 385 Multichain Governance - Revoke", await vip385(), { callbackAfterExecution: async txResponse => { - await expectEvents(txResponse, [ACCESS_CONTROL_MANAGER_ABI], ["PermissionRevoked"], [48]); + await expectEvents(txResponse, [ACCESS_CONTROL_MANAGER_ABI], ["PermissionRevoked"], [60]); await expectEvents(txResponse, [ACMAggregator_ABI], ["RevokePermissionsExecuted"], [1]); }, }); @@ -29,6 +23,5 @@ forking(18511708, async () => { it("check if DEFAULT_ROLE has been revoked for ACMAggregator", async () => { expect(await acm.hasRole(DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR)).to.be.false; }); - }); -}); \ No newline at end of file +}); diff --git a/simulations/vip-385/bsctestnet.ts b/simulations/vip-385/bsctestnet.ts index 38a713c16..b0b7273e8 100644 --- a/simulations/vip-385/bsctestnet.ts +++ b/simulations/vip-385/bsctestnet.ts @@ -1,17 +1,13 @@ -import { expect } from "chai"; -import { ethers } from "hardhat"; import { NETWORK_ADDRESSES } from "src/networkAddresses"; -import { LzChainId } from "src/types"; import { expectEvents } from "src/utils"; -import { forking, pretendExecutingVip, testVip } from "src/vip-framework"; +import { forking, testVip } from "src/vip-framework"; import vip384 from "../../vips/vip-384/bsctestnet"; import vip385 from "../../vips/vip-385/bsctestnet"; import OMNICHAIN_PROPOSAL_SENDER_ABI from "./abi/OmnichainProposalSender.json"; -const { basesepolia } = NETWORK_ADDRESSES; forking(46023795, async () => { - testVip("VIP 384 Multichain Governance - Grant Permissions", await vip384(), {}) + testVip("VIP 384 Multichain Governance - Grant Permissions", await vip384(), {}); testVip("VIP 385 Multichain Governance - Revoke Permissions", await vip385(), { callbackAfterExecution: async txResponse => { @@ -23,4 +19,4 @@ forking(46023795, async () => { ); }, }); -}); \ No newline at end of file +}); diff --git a/vips/vip-385/bsctestnet.ts b/vips/vip-385/bsctestnet.ts index 99732a15d..e90fc7bd3 100644 --- a/vips/vip-385/bsctestnet.ts +++ b/vips/vip-385/bsctestnet.ts @@ -1,8 +1,6 @@ -import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { LzChainId, ProposalType } from "src/types"; import { makeProposal } from "src/utils"; -const { basesepolia } = NETWORK_ADDRESSES; export const ACM = "0x724138223D8F76b519fdE715f60124E7Ce51e051"; export const DEFAULT_ADMIN_ROLE = "0x0000000000000000000000000000000000000000000000000000000000000000"; export const ACM_AGGREGATOR = "0xd82A217713F6c61f3ed4199cdEEDfbB80e5E4562"; @@ -24,18 +22,18 @@ const vip389 = () => { params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], dstChainId: LzChainId.basesepolia, }, - // { - // target: ACM_AGGREGATOR, - // signature: "executeRevokePermissions(uint256)", - // params: [1], - // dstChainId: LzChainId.basesepolia, - // }, - // { - // target: ACM, - // signature: "revokeRole(bytes32,address)", - // params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], - // dstChainId: LzChainId.basesepolia, - // }, + { + target: ACM_AGGREGATOR, + signature: "executeRevokePermissions(uint256)", + params: [1], + dstChainId: LzChainId.basesepolia, + }, + { + target: ACM, + signature: "revokeRole(bytes32,address)", + params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], + dstChainId: LzChainId.basesepolia, + }, ], meta, ProposalType.REGULAR, From a75b387c79d4b7c7f35c0fadec010c3da78ab0ac Mon Sep 17 00:00:00 2001 From: web3rover Date: Fri, 29 Nov 2024 18:06:12 +0700 Subject: [PATCH 3/5] fix: fixed lint --- simulations/vip-385/bsctestnet.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/simulations/vip-385/bsctestnet.ts b/simulations/vip-385/bsctestnet.ts index b0b7273e8..4ec06d50e 100644 --- a/simulations/vip-385/bsctestnet.ts +++ b/simulations/vip-385/bsctestnet.ts @@ -1,4 +1,3 @@ -import { NETWORK_ADDRESSES } from "src/networkAddresses"; import { expectEvents } from "src/utils"; import { forking, testVip } from "src/vip-framework"; From 081ec1ec17d51ee73e3f7cde54c05e8dc1637157 Mon Sep 17 00:00:00 2001 From: web3rover Date: Mon, 2 Dec 2024 23:03:02 +0530 Subject: [PATCH 4/5] fix: fixed permissions --- simulations/vip-385/basesepolia.ts | 2 +- vips/vip-385/bsctestnet.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simulations/vip-385/basesepolia.ts b/simulations/vip-385/basesepolia.ts index 02d22af8b..0979f9a11 100644 --- a/simulations/vip-385/basesepolia.ts +++ b/simulations/vip-385/basesepolia.ts @@ -8,7 +8,7 @@ import vip385, { ACM, ACM_AGGREGATOR, DEFAULT_ADMIN_ROLE } from "../../vips/vip- import ACMAggregator_ABI from "./abi/ACMAggregator.json"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager_ABI.json"; -forking(18511708, async () => { +forking(18695738, async () => { await pretendExecutingVip(await vip006()); testForkedNetworkVipCommands("VIP 385 Multichain Governance - Revoke", await vip385(), { callbackAfterExecution: async txResponse => { diff --git a/vips/vip-385/bsctestnet.ts b/vips/vip-385/bsctestnet.ts index e90fc7bd3..59cf5412c 100644 --- a/vips/vip-385/bsctestnet.ts +++ b/vips/vip-385/bsctestnet.ts @@ -25,7 +25,7 @@ const vip389 = () => { { target: ACM_AGGREGATOR, signature: "executeRevokePermissions(uint256)", - params: [1], + params: [2], dstChainId: LzChainId.basesepolia, }, { From 52edc0fd802068a2402802e4d11f471b2e756d9f Mon Sep 17 00:00:00 2001 From: Narayan Prusty Date: Wed, 4 Dec 2024 17:06:46 +0530 Subject: [PATCH 5/5] fix: added grant permissions --- simulations/vip-385/basesepolia.ts | 4 +++- vips/vip-384/bsctestnet.ts | 2 +- vips/vip-385/bsctestnet.ts | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/simulations/vip-385/basesepolia.ts b/simulations/vip-385/basesepolia.ts index 0979f9a11..5dc299742 100644 --- a/simulations/vip-385/basesepolia.ts +++ b/simulations/vip-385/basesepolia.ts @@ -8,12 +8,14 @@ import vip385, { ACM, ACM_AGGREGATOR, DEFAULT_ADMIN_ROLE } from "../../vips/vip- import ACMAggregator_ABI from "./abi/ACMAggregator.json"; import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager_ABI.json"; -forking(18695738, async () => { +forking(18771563, async () => { await pretendExecutingVip(await vip006()); testForkedNetworkVipCommands("VIP 385 Multichain Governance - Revoke", await vip385(), { callbackAfterExecution: async txResponse => { await expectEvents(txResponse, [ACCESS_CONTROL_MANAGER_ABI], ["PermissionRevoked"], [60]); await expectEvents(txResponse, [ACMAggregator_ABI], ["RevokePermissionsExecuted"], [1]); + await expectEvents(txResponse, [ACCESS_CONTROL_MANAGER_ABI], ["PermissionGranted"], [194]); + await expectEvents(txResponse, [ACMAggregator_ABI], ["GrantPermissionsExecuted"], [1]); }, }); diff --git a/vips/vip-384/bsctestnet.ts b/vips/vip-384/bsctestnet.ts index 7808b7ea0..bbe063b40 100644 --- a/vips/vip-384/bsctestnet.ts +++ b/vips/vip-384/bsctestnet.ts @@ -14,7 +14,7 @@ export const MAX_DAILY_LIMIT = 100; const vip389 = () => { const meta = { version: "v2", - title: "VIP-389 Enable Multichain Governance on op sepolia", + title: "VIP-389 Enable Multichain Governance on base sepolia", description: `### Summary`, forDescription: "I agree that Venus Protocol should proceed with this proposal", againstDescription: "I do not think that Venus Protocol should proceed with this proposal", diff --git a/vips/vip-385/bsctestnet.ts b/vips/vip-385/bsctestnet.ts index 59cf5412c..38f397c15 100644 --- a/vips/vip-385/bsctestnet.ts +++ b/vips/vip-385/bsctestnet.ts @@ -8,7 +8,7 @@ export const ACM_AGGREGATOR = "0xd82A217713F6c61f3ed4199cdEEDfbB80e5E4562"; const vip389 = () => { const meta = { version: "v2", - title: "VIP-389 Enable Multichain Governance on op sepolia", + title: "VIP-389 Enable Multichain Governance on base sepolia", description: `### Summary`, forDescription: "I agree that Venus Protocol should proceed with this proposal", againstDescription: "I do not think that Venus Protocol should proceed with this proposal", @@ -22,6 +22,12 @@ const vip389 = () => { params: [DEFAULT_ADMIN_ROLE, ACM_AGGREGATOR], dstChainId: LzChainId.basesepolia, }, + { + target: ACM_AGGREGATOR, + signature: "executeGrantPermissions(uint256)", + params: [3], + dstChainId: LzChainId.basesepolia, + }, { target: ACM_AGGREGATOR, signature: "executeRevokePermissions(uint256)",