Skip to content

Commit 0781da9

Browse files
authored
[SDK] Check bytecode prefix (#6196)
1 parent c5dfad8 commit 0781da9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

codecov.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
coverage:
2+
ignore:
3+
- "**/__generated__/**"
4+
- "**/contract/deployment/zksync/**"
5+
- "*/thirdweb/src/contract/deployment/zksync/zkDeployContract.ts"
26
status:
37
project:
48
default:
@@ -10,6 +14,8 @@ coverage:
1014
- packages
1115
ignore:
1216
- "**/__generated__/**"
17+
- "**/contract/deployment/zksync/**"
18+
- "*/thirdweb/src/contract/deployment/zksync/zkDeployContract.ts"
1319

1420

1521
github_checks:

packages/thirdweb/src/contract/deployment/zksync/zkDeployContract.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { sendAndConfirmTransaction } from "../../../transaction/actions/send-and
66
import { prepareTransaction } from "../../../transaction/prepare-transaction.js";
77
import { normalizeFunctionParams } from "../../../utils/abi/normalizeFunctionParams.js";
88
import { CONTRACT_DEPLOYER_ADDRESS } from "../../../utils/any-evm/zksync/constants.js";
9+
import { ensureBytecodePrefix } from "../../../utils/bytecode/prefix.js";
910
import type { Hex } from "../../../utils/encoding/hex.js";
1011
import type { ClientAndChainAndAccount } from "../../../utils/types.js";
1112
import { zkDeployContractDeterministic } from "./zkDeployDeterministic.js";
@@ -22,14 +23,16 @@ export async function zkDeployContract(
2223
deploymentType?: "create" | "create2";
2324
},
2425
) {
26+
const bytecode = ensureBytecodePrefix(options.bytecode);
27+
2528
if (options.salt !== undefined) {
2629
// if a salt is provided, use the deterministic deployer
2730
return zkDeployContractDeterministic(options);
2831
}
2932

3033
const data = encodeDeployData({
3134
abi: options.abi,
32-
bytecode: options.bytecode,
35+
bytecode,
3336
deploymentType: options.deploymentType ?? "create",
3437
args: normalizeFunctionParams(
3538
options.abi.find((abi) => abi.type === "constructor"),
@@ -45,7 +48,7 @@ export async function zkDeployContract(
4548
to: CONTRACT_DEPLOYER_ADDRESS,
4649
data,
4750
eip712: {
48-
factoryDeps: [options.bytecode],
51+
factoryDeps: [bytecode],
4952
// TODO (zksync): allow passing in a paymaster
5053
},
5154
}),

0 commit comments

Comments
 (0)