Skip to content

Commit

Permalink
Merge pull request #437 from txfusion/fix-zksync-deployment
Browse files Browse the repository at this point in the history
Fix zksync deployment
  • Loading branch information
wighawag committed Apr 8, 2023
2 parents aaba1a9 + 4a8fa9e commit 83e16e1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"match-all": "^1.2.6",
"murmur-128": "^0.2.1",
"qs": "^6.9.4",
"zksync-web3": "^0.8.1"
"zksync-web3": "^0.14.3"
},
"scripts": {
"prepare": "node ./.setup.js",
Expand All @@ -85,4 +85,4 @@
"publish:release": "npm publish",
"prepublishOnly": "npm run build"
}
}
}
3 changes: 3 additions & 0 deletions src/DeploymentsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,9 @@ export class DeploymentsManager {
gasEstimates: deployment.gasEstimates, // TODO double check : use evm field ?
})
);
if (deployment.factoryDeps?.length) {
obj.factoryDeps = deployment.factoryDeps;
}
this.db.deployments[name] = obj;
if (obj.address === undefined && obj.transactionHash !== undefined) {
let receiptFetched;
Expand Down
11 changes: 5 additions & 6 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,13 +548,14 @@ export function addHelpers(
};

let factory;
let factoryDeps: string[] = [];
if (network.zksync) {
factory = new zk.ContractFactory(
linkedArtifact.abi,
linkedArtifact.bytecode,
ethersSigner as zk.Signer
);
const factoryDeps = await extractFactoryDeps(linkedArtifact);
factoryDeps = await extractFactoryDeps(linkedArtifact);
const customData = {
customData: {
factoryDeps,
Expand Down Expand Up @@ -676,6 +677,7 @@ export function addHelpers(
receipt,
transactionHash: receipt.transactionHash,
libraries: options.libraries,
factoryDeps,
};
await saveDeployment(name, deployment);
if (options.log || hardwareWallet) {
Expand Down Expand Up @@ -956,13 +958,10 @@ export function addHelpers(
});
const newData = newTransaction.data?.toString();

const deserialize = zk.utils.parseTransaction(
transaction.data
) as any;
const desFlattened = hexConcat(deserialize.customData.factoryDeps);
const oldFlattened = hexConcat(deployment.factoryDeps || []);
const newFlattened = hexConcat(factoryDeps);

if (deserialize.data !== newData || desFlattened != newFlattened) {
if (transaction.data !== newData || oldFlattened != newFlattened) {
return {differences: true, address: deployment.address};
}
return {differences: false, address: deployment.address};
Expand Down
2 changes: 2 additions & 0 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export interface DeploymentSubmission {
storageLayout?: any;
libraries?: Libraries;
gasEstimates?: any;
factoryDeps?: string[];
}

// export type LibraryReferences = {
Expand Down Expand Up @@ -376,6 +377,7 @@ export interface Deployment {
facets?: Facet[];
storageLayout?: any;
gasEstimates?: any;
factoryDeps?: string[];
}

export interface DeterministicDeploymentInfo {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5124,7 +5124,7 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

zksync-web3@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.8.1.tgz#db289d8f6caf61f4d5ddc471fa3448d93208dc14"
integrity sha512-1A4aHPQ3MyuGjpv5X/8pVEN+MdZqMjfVmiweQSRjOlklXYu65wT9BGEOtCmMs5d3gIvLp4ssfTeuR5OCKOD2kw==
zksync-web3@^0.14.3:
version "0.14.3"
resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9"
integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ==

0 comments on commit 83e16e1

Please sign in to comment.