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

Zksync testing #596

Draft
wants to merge 120 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
039cbe6
modify deployment script for more flexibility
novaknole Apr 3, 2024
c18a063
remove comments
novaknole Apr 3, 2024
5cb8a86
skip multisig
novaknole Apr 5, 2024
2c891a1
uncomment comment
novaknole Apr 5, 2024
86af1e0
comment managing-dao upgrade tests
novaknole Apr 6, 2024
fd84941
feat: update checklist and modify managing dao test
novaknole Apr 8, 2024
7dde6e5
feat: update checklist
novaknole Apr 8, 2024
2845e42
feat: remove comment from test
novaknole Apr 8, 2024
8c36a1a
feat: remove unused comment
novaknole Apr 8, 2024
83bc585
enable root permission on deployer
novaknole Apr 10, 2024
d1d4fcf
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 11, 2024
a78beb4
Update packages/contracts/deploy/helpers.ts
novaknole Apr 11, 2024
d4380eb
Update packages/contracts/deploy/helpers.ts
novaknole Apr 11, 2024
e03bad8
fix: remove commented code
novaknole Apr 12, 2024
f0f9d67
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 12, 2024
5ed8514
Update packages/contracts/deploy/new/10_framework/01_ens_subdomains.ts
novaknole Apr 12, 2024
80872d0
update comments
novaknole Apr 12, 2024
6450fce
Merge branch 'deployments/old-contracts' of https://github.com/aragon…
novaknole Apr 12, 2024
9b98b9a
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 12, 2024
c116cf8
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 12, 2024
a953ba8
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 12, 2024
7cd85c9
first iteration of zksync deployment
novaknole Apr 16, 2024
db0b239
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 16, 2024
5202a3c
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
4c40500
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
eaacb7b
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
6e6a795
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
da14c4d
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
8c92391
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
1865845
Update 50_save-contract-addresses.ts
brickpop Apr 16, 2024
df29a93
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
3c06990
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
1ecd628
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
9743f2a
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
1fb6493
Update DEPLOYMENT_CHECKLIST.md
brickpop Apr 16, 2024
74f7bd5
show the error message for ens
novaknole Apr 17, 2024
ade7d68
Merge branch 'deployments/simpler-deployment' of https://github.com/a…
novaknole Apr 17, 2024
7eab994
apply factory depth check
novaknole Apr 17, 2024
6073d1c
add testnet for zksync
novaknole Apr 17, 2024
104f3cd
Removing the IPFS pin step for the Managing DAO
brickpop Apr 17, 2024
3559b7c
Improving the deployment checklist
brickpop Apr 17, 2024
eb8f4ff
push
novaknole Apr 28, 2024
46faf3c
hardhat-deploy use latest version
Apr 29, 2024
8112333
remove skipDeploys
Apr 29, 2024
128f9e2
update managing dao test
Apr 29, 2024
77771b6
EOA fix
Apr 29, 2024
22f1a07
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 29, 2024
5d991e3
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 29, 2024
dbbd6eb
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 29, 2024
650eb01
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 29, 2024
502be5c
Update DEPLOYMENT_CHECKLIST.md
novaknole Apr 29, 2024
e8367f0
fix yarn.lock
Apr 29, 2024
b1bb84e
fix prettier and execute permissions
Apr 29, 2024
74868e8
Merge branch 'feature/deploy-script-improvement' of https://github.co…
Apr 29, 2024
440d673
Update packages/contracts/deploy/helpers.ts
novaknole Apr 30, 2024
4947c72
f:starting tests
Apr 30, 2024
a193986
fix: yarn and imports
Apr 30, 2024
ac39ced
Merge branch 'feature/deploy-script-improvement' of https://github.co…
Apr 30, 2024
95a3d2e
midway tests: finished
May 2, 2024
5d9f10f
fix: remove test deploy scripts
May 2, 2024
17be7ac
fix:prettier
May 2, 2024
abe4fe2
feature: start to work on upgrades
May 2, 2024
664cdf2
fix: upgrades tests
May 2, 2024
f9f450d
fix smocks in dao.ts
May 4, 2024
9ed2412
fix psp tests to accomodate zksync
May 4, 2024
fbd79fb
added matcher and readme
jordaniza May 6, 2024
d4dfbb9
fix: replaced MANAGINGDAO_ with MANAGEMENT_DAO_
jordaniza May 8, 2024
43dc46a
f: 90% tests finished
May 8, 2024
970d591
Merge branch 'zksync-testing' into feature/deploy-script-improvement
jordaniza May 8, 2024
81045b6
chore: revert yarn lock changes
jordaniza May 8, 2024
fd7657e
Merge pull request #582 from aragon/feature/deploy-script-improvement
jordaniza May 8, 2024
66e70d3
add zksync contracts
May 8, 2024
50b2bea
merged
May 8, 2024
c52508a
skip tests
May 8, 2024
d5e19ae
fix: added matchers, skip fns for admin and tweaks to zkTokenVoting
jordaniza May 8, 2024
05ff013
add skips to zksync specific contracts'
May 8, 2024
91dc5aa
add testvotingsetupzksync in deploy scripts
May 8, 2024
61e1187
fix deploy scripts and make psp upgradeable
May 9, 2024
6ea87dc
fix token voting test
May 9, 2024
9a584e3
revert back to 'to be reverted'
May 9, 2024
3533c9d
tech debt in wrapper class + upgradeable tests
May 10, 2024
e0c0d6f
psp upgradeable tests
May 10, 2024
79bd788
governance contracts non-upgradeable
May 13, 2024
7e815f0
fix: merge conflicts
May 15, 2024
533c4c0
Update packages/contracts/.gitignore
novaknole May 15, 2024
6828c91
Update packages/contracts/hardhat.config.ts
novaknole May 15, 2024
25ff98f
remove log
May 15, 2024
86d71d1
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
May 15, 2024
73733de
Update packages/contracts/hardhat.config.ts
novaknole May 15, 2024
916994e
fix package.json
May 15, 2024
3ce65c0
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
May 15, 2024
1afc051
Update packages/contracts/hardhat.config.ts
novaknole May 15, 2024
e0bc39b
add explanation for create wrapper
May 15, 2024
9e4414c
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
May 15, 2024
0eb83e3
Update packages/contracts/test/deploy/managing-dao.ts
novaknole May 15, 2024
d96ee81
Update packages/contracts/README-zkSync.md
novaknole May 15, 2024
2b20141
Update packages/contracts/src/zksync/TokenVotingSetupZkSync.sol
novaknole May 15, 2024
711dfa2
Update packages/contracts/src/zksync/PluginSetupProcessorUpgradeable.sol
novaknole May 15, 2024
f0756ac
removed unnecessary check in zksync token voting deploy
May 15, 2024
56956da
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
May 15, 2024
20debe2
style: apply prettier formatting
heueristik May 16, 2024
db28fec
Update packages/contracts/test/test-utils/wrapper/hardhat.ts
novaknole May 16, 2024
6710f4e
fix governance-wrapped-erc20
May 16, 2024
9cd35fc
rename contract deploy names
May 17, 2024
6fb8ca9
remove unnecessary describes
May 17, 2024
9dd36e3
fix: null pointer exception on multisig proposals
Rekard0 May 17, 2024
5337866
feat: add zksync-era-sepolia data source
Rekard0 May 17, 2024
973bef6
Update packages/contracts/README-zkSync.md
novaknole May 20, 2024
483e6a2
update subgraph addresses
May 21, 2024
a543127
fix: use try_function (#598)
Rekard0 May 29, 2024
7e51be0
add psp upgradability test
Jun 19, 2024
cfeda13
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
Jun 19, 2024
a32ea44
add special treatment
Rekard0 Jun 19, 2024
4b8edf9
improve special token detection
Rekard0 Jun 19, 2024
03b7077
update timestamp
Jun 25, 2024
ecee462
Merge branch 'zksync-testing' of https://github.com/aragon/osx into z…
Jun 25, 2024
1343326
remove txt file
Jun 25, 2024
7c86a01
update hardhat config
Jun 25, 2024
8b9cf82
remove console
Jun 25, 2024
2d1aa5f
chor: add zkSync era support to subgraph
Rekard0 Jun 25, 2024
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
Prev Previous commit
Next Next commit
tech debt in wrapper class + upgradeable tests
Giorgi Lagidze authored and Giorgi Lagidze committed May 10, 2024
commit 3533c9d9fed284c588503a6cc534cab515827b19
12 changes: 7 additions & 5 deletions packages/contracts/test/core/dao/dao.ts
Original file line number Diff line number Diff line change
@@ -332,12 +332,14 @@ describe('DAO', function () {
0,
1,
{
metadata: dummyMetadata1,
initialOwner: signers[0].address,
trustedForwarder: dummyAddress1,
daoURI: daoExampleURI,
initArgs: {
metadata: dummyMetadata1,
initialOwner: signers[0].address,
trustedForwarder: dummyAddress1,
daoURI: daoExampleURI,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.DAO_V1_0_0,
ARTIFACT_SOURCES.DAO,
UPGRADE_PERMISSIONS.UPGRADE_DAO_PERMISSION_ID
8 changes: 5 additions & 3 deletions packages/contracts/test/framework/dao/dao-registry.ts
Original file line number Diff line number Diff line change
@@ -272,10 +272,12 @@ describe('DAORegistry', function () {
1,
managingDao,
{
dao: managingDao.address,
ensSubdomainRegistrar: ensSubdomainRegistrar.address,
initArgs: {
dao: managingDao.address,
ensSubdomainRegistrar: ensSubdomainRegistrar.address,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.DAO_REGISTRY_V1_0_0,
ARTIFACT_SOURCES.DAO_REGISTRY,
UPGRADE_PERMISSIONS.UPGRADE_REGISTRY_PERMISSION_ID
10 changes: 6 additions & 4 deletions packages/contracts/test/framework/plugin/plugin-repo-registry.ts
Original file line number Diff line number Diff line change
@@ -280,12 +280,14 @@ describe('PluginRepoRegistry', function () {
1,
managingDAO,
{
dao: managingDAO.address,
ensSubdomainRegistrar: ensSubdomainRegistrar.address,
initArgs: {
dao: managingDAO.address,
ensSubdomainRegistrar: ensSubdomainRegistrar.address,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.PLUGIN_REPO_REGISTRY,
ARTIFACT_SOURCES.PLUGIN_REPO_REGISTRY_V1_0_0,
ARTIFACT_SOURCES.PLUGIN_REPO_REGISTRY,
UPGRADE_PERMISSIONS.UPGRADE_REGISTRY_PERMISSION_ID
);

6 changes: 4 additions & 2 deletions packages/contracts/test/framework/plugin/plugin-repo.ts
Original file line number Diff line number Diff line change
@@ -94,9 +94,11 @@ describe('PluginRepo', function () {
0,
1,
{
initialOwner: signers[0].address,
initArgs: {
initialOwner: signers[0].address,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.PLUGIN_REPO_V1_0_0,
ARTIFACT_SOURCES.PLUGIN_REPO,
UPGRADE_PERMISSIONS.UPGRADE_REPO_PERMISSION_ID
Original file line number Diff line number Diff line change
@@ -301,11 +301,13 @@ describe('ENSSubdomainRegistrar', function () {
1,
managingDao,
{
managingDao: managingDao.address,
ens: ens.address,
parentDomain: ensDomainHash('test'),
initArgs: {
managingDao: managingDao.address,
ens: ens.address,
parentDomain: ensDomainHash('test'),
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.ENS_SUBDOMAIN_REGISTRAR_V1_0_0,
ARTIFACT_SOURCES.ENS_SUBDOMAIN_REGISTRAR,
UPGRADE_PERMISSIONS.UPGRADE_REGISTRAR_PERMISSION_ID
Original file line number Diff line number Diff line change
@@ -154,11 +154,13 @@ describe('AddresslistVoting', function () {
1,
dao,
{
dao: dao.address,
votingSettings: votingSettings,
members: [signers[0].address, signers[1].address],
initArgs: {
dao: dao.address,
votingSettings: votingSettings,
members: [signers[0].address, signers[1].address],
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.ADDRESSLIST_VOTING_V1_0_0,
ARTIFACT_SOURCES.ADDRESSLIST_VOTING,
UPGRADE_PERMISSIONS.UPGRADE_PLUGIN_PERMISSION_ID
Original file line number Diff line number Diff line change
@@ -215,11 +215,13 @@ describe('TokenVoting', function () {
1,
dao,
{
dao: dao.address,
votingSettings: votingSettings,
token: governanceErc20Mock.address,
initArgs: {
dao: dao.address,
votingSettings: votingSettings,
token: governanceErc20Mock.address,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.TOKEN_VOTING_V1_0_0,
ARTIFACT_SOURCES.TOKEN_VOTING,
UPGRADE_PERMISSIONS.UPGRADE_PLUGIN_PERMISSION_ID
18 changes: 10 additions & 8 deletions packages/contracts/test/plugins/governance/multisig/multisig.ts
Original file line number Diff line number Diff line change
@@ -240,15 +240,17 @@ describe('Multisig', function () {
1,
dao,
{
dao: dao.address,
members: [
signers[0].address,
signers[1].address,
signers[2].address,
],
multisigSettings: multisigSettings,
initArgs: {
dao: dao.address,
members: [
signers[0].address,
signers[1].address,
signers[2].address,
],
multisigSettings: multisigSettings,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.MULTISIG_V1_0_0,
ARTIFACT_SOURCES.MULTISIG,
UPGRADE_PERMISSIONS.UPGRADE_PLUGIN_PERMISSION_ID
Original file line number Diff line number Diff line change
@@ -97,13 +97,15 @@ describe('MerkleDistributor', function () {
1,
dao,
{
dao: dao.address,
token: token.address,
merkleRoot: ZERO_BYTES32,
initArgs: {
dao: dao.address,
token: token.address,
merkleRoot: ZERO_BYTES32,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.MERKLE_DISTRIBUTOR,
ARTIFACT_SOURCES.MERKLE_DISTRIBUTOR_V1_0_0,
ARTIFACT_SOURCES.MERKLE_DISTRIBUTOR,
UPGRADE_PERMISSIONS.UPGRADE_PLUGIN_PERMISSION_ID
);

Original file line number Diff line number Diff line change
@@ -106,11 +106,13 @@ describe('MerkleMinter', function () {
1,
managingDao,
{
dao: managingDao.address,
token: token.address,
merkleDistributor: distributorBase.address,
initArgs: {
dao: managingDao.address,
token: token.address,
merkleDistributor: distributorBase.address,
},
initializer: 'initialize',
},
'initialize',
ARTIFACT_SOURCES.MERKLE_MINTER_V1_0_0,
ARTIFACT_SOURCES.MERKLE_MINTER,
UPGRADE_PERMISSIONS.UPGRADE_PLUGIN_PERMISSION_ID
3 changes: 3 additions & 0 deletions packages/contracts/test/test-utils/permissions.ts
Original file line number Diff line number Diff line change
@@ -10,4 +10,7 @@ export const UPGRADE_PERMISSIONS = {
'UPGRADE_REGISTRAR_PERMISSION'
),
UPGRADE_REPO_PERMISSION_ID: ethers.utils.id('UPGRADE_REPO_PERMISSION'),
UPGRADE_GOVERNANCE_ERC20_PERMISSION_ID: ethers.utils.id(
'UPGRADE_GOVERNANCE_ERC20_PERMISSION'
),
};
47 changes: 32 additions & 15 deletions packages/contracts/test/test-utils/uups-upgradeable.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
import {expect} from 'chai';
import {ContractFactory, errors} from 'ethers';
import hre, {ethers, upgrades, zksyncEthers} from 'hardhat';
import {errors} from 'ethers';
import hre from 'hardhat';
import {DAO} from '../../typechain';
import {readImplementationValueFromSlot} from '../../utils/storage';
import {Contract} from 'zksync-ethers';

type options = {
args?: Record<string, any>;
initArgs?: Record<string, any>;
initializer?: string | undefined;
};

// Deploys and upgrades a contract that is managed by a DAO
export async function ozUpgradeCheckManagedContract(
deployer: number,
upgrader: number,
managingDao: DAO,
initArgs: any,
initializerName: string,
{args = {}, initArgs = {}, initializer = undefined}: options,
from: string,
to: string,
upgradePermissionId: string
@@ -25,9 +29,10 @@ export async function ozUpgradeCheckManagedContract(
const upgraderSigner = (await hre.ethers.getSigners())[upgrader];

let proxy = await hre.wrapper.deployProxy(deployer, from, {
args: Object.values(initArgs),
args: Object.values(args),
initArgs: Object.values(initArgs),
proxySettings: {
initializer: initializerName,
initializer: initializer,
},
});

@@ -36,7 +41,11 @@ export async function ozUpgradeCheckManagedContract(
);

// Check that upgrade permission is required
await expect(hre.wrapper.upgradeProxy(upgrader, proxy.address, to))
await expect(
hre.wrapper.upgradeProxy(upgrader, proxy.address, to, {
args: Object.values(args),
})
)
.to.be.revertedWithCustomError(proxy, 'DaoUnauthorized')
.withArgs(
managingDao.address,
@@ -51,7 +60,9 @@ export async function ozUpgradeCheckManagedContract(
.grant(proxy.address, upgraderSigner.address, upgradePermissionId);

// Upgrade the proxy
await hre.wrapper.upgradeProxy(upgrader, proxy.address, to);
await hre.wrapper.upgradeProxy(upgrader, proxy.address, to, {
args: Object.values(args),
});

const toImplementation = await readImplementationValueFromSlot(proxy.address);

@@ -62,8 +73,7 @@ export async function ozUpgradeCheckManagedContract(
export async function ozUpgradeCheckManagingContract(
deployer: number,
upgrader: number,
initArgs: any,
initializerName: string,
{args = {}, initArgs = {}, initializer = undefined}: options,
from: string,
to: string,
upgradePermissionId: string
@@ -77,9 +87,10 @@ export async function ozUpgradeCheckManagingContract(

// Deploy the proxy
let proxy = await hre.wrapper.deployProxy(deployer, from, {
args: Object.values(initArgs),
args: Object.values(args),
initArgs: Object.values(initArgs),
proxySettings: {
initializer: initializerName,
initializer: initializer,
},
});

@@ -88,7 +99,11 @@ export async function ozUpgradeCheckManagingContract(
);

// Check that upgrade permission is required
await expect(hre.wrapper.upgradeProxy(upgrader, proxy.address, to))
await expect(
hre.wrapper.upgradeProxy(upgrader, proxy.address, to, {
args: Object.values(args),
})
)
.to.be.revertedWithCustomError(proxy, 'Unauthorized')
.withArgs(proxy.address, upgraderSigner.address, upgradePermissionId);

@@ -97,7 +112,9 @@ export async function ozUpgradeCheckManagingContract(
.connect(deployerSigner)
.grant(proxy.address, upgraderSigner.address, upgradePermissionId);

await hre.wrapper.upgradeProxy(upgrader, proxy.address, to);
await hre.wrapper.upgradeProxy(upgrader, proxy.address, to, {
args: Object.values(args),
});

const toImplementation = await readImplementationValueFromSlot(proxy.address);

19 changes: 9 additions & 10 deletions packages/contracts/test/test-utils/wrapper/hardhat.ts
heueristik marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import hre from 'hardhat';
import {BigNumberish, Contract, providers} from 'ethers';
import {utils} from 'ethers';

import {NetworkDeployment} from '.';
import {DeployOptions, NetworkDeployment} from '.';
import {getTime} from '../voting';

export class HardhatClass implements NetworkDeployment {
@@ -39,9 +39,7 @@ export class HardhatClass implements NetworkDeployment {
async deployProxy(
deployer: number,
artifactName: string,
type: string,
args: any[],
initializer: string
options: DeployOptions
): Promise<Contract> {
const {ethers} = hre;
const signer = (await ethers.getSigners())[deployer];
@@ -54,18 +52,19 @@ export class HardhatClass implements NetworkDeployment {
);

// Currently, it doesn't use type and always deployes with uups
return hre.upgrades.deployProxy(contract, args, {
kind: 'uups',
initializer: initializer,
return hre.upgrades.deployProxy(contract, options.initArgs, {
kind: options.proxySettings?.type,
initializer: options.proxySettings?.initializer ?? false,
unsafeAllow: ['constructor'],
constructorArgs: [],
constructorArgs: options.args,
});
}

async upgradeProxy(
upgrader: number,
proxyAddress: string,
newArtifactName: string
newArtifactName: string,
options: DeployOptions
): Promise<Contract> {
const {ethers} = hre;
const signer = (await ethers.getSigners())[upgrader];
@@ -80,7 +79,7 @@ export class HardhatClass implements NetworkDeployment {

return hre.upgrades.upgradeProxy(proxyAddress, contract, {
novaknole marked this conversation as resolved.
Show resolved Hide resolved
unsafeAllow: ['constructor'],
constructorArgs: [],
constructorArgs: options.args,
});
}
}
Loading