Skip to content

Commit

Permalink
Fix zksync factory dependencies comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
mpavlovic-txfusion committed Apr 2, 2023
1 parent e754886 commit 4a8fa9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
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

0 comments on commit 4a8fa9e

Please sign in to comment.