Skip to content

Commit

Permalink
Remove creationBytecode from the session data
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocastignoli committed Apr 4, 2024
1 parent 84d2e28 commit e3f5a4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/lib-sourcify/src/lib/CheckedContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,14 @@ export class CheckedContract {
}
}

// Function to export the minimum information to reconstruct the CheckedContract
exportConstructorArguments() {
return {
metadata: this.metadata,
solidity: this.solidity,
missing: this.missing,
invalid: this.invalid,
creationBytecode: this.creationBytecode,
// creationBytecode: this.creationBytecode, // Not needed without create2
compiledPath: this.compiledPath,
name: this.name,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export type SendableContract = ContractMeta & {
};
verificationId: string;
constructorArgumentsArray?: Mutable<AbiParameter[]>;
creationBytecode?: string;
// creationBytecode?: string; // Not needed without create2
};

function getSendableContract(
Expand All @@ -184,7 +184,7 @@ function getSendableContract(
(abi) => abi.type === "constructor"
) as AbiConstructor
)?.inputs as Mutable<AbiParameter[]>,
creationBytecode: contract?.creationBytecode,
// : contract?.creationBytecode, // Not needed without create2
compiledPath: contract.compiledPath,
name: contract.name,
address: contractWrapper.address,
Expand Down Expand Up @@ -244,6 +244,7 @@ export const checkContractsInSession = async (session: Session) => {
const newPendingContracts: ContractWrapperMap = {};
for (const contract of contracts) {
newPendingContracts[generateId(JSON.stringify(contract.metadataRaw))] = {
// Remove large (e.g. bytecodes) and unnecessary (e.g. `solidityCompiler`) fields in CheckedContract before saving to the session. Essentially a CheckedContract only needs a few fields to be generated.
contract: contract.exportConstructorArguments(),
};
}
Expand Down

0 comments on commit e3f5a4c

Please sign in to comment.