|
1 | 1 | import { Deployer, Reporter } from "@solarity/hardhat-migrate"; |
2 | 2 |
|
3 | | -import { HistoryProofVerifier914432__factory, ICreateX__factory, HistoricalSPVGateway__factory } from "@ethers-v6"; |
| 3 | +import { ICreateX__factory, HistoricalSPVGateway__factory } from "@ethers-v6"; |
4 | 4 |
|
5 | 5 | import path from "path"; |
6 | 6 | import { ethers } from "hardhat"; |
7 | 7 | import { getHistoryProofFromFile, getHistoryProofPublicInputsFromFile } from "@/test/helpers"; |
8 | 8 |
|
9 | 9 | import { getHistoricalConfig } from "../config/config"; |
10 | 10 | import { getGuardedSalt } from "../helpers/helpers"; |
| 11 | +import { deployHistoryVerifier } from "./helpers"; |
11 | 12 |
|
12 | 13 | export = async (deployer: Deployer) => { |
13 | 14 | const config = await getHistoricalConfig(); |
14 | 15 |
|
15 | 16 | const createXDeployer = await deployer.deployed(ICreateX__factory, "0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed"); |
16 | 17 |
|
17 | | - // zero address + 00 (cross-chain redeploy protection) + 0000 + ASCII(HPV914432) |
18 | | - const historyVerifier914432Salt = `0x0000000000000000000000000000000000000000000000485056393134343332`; |
19 | | - |
20 | | - await createXDeployer.deployCreate2(historyVerifier914432Salt, HistoryProofVerifier914432__factory.bytecode); |
21 | | - |
22 | | - const historyVerifierAddress = await createXDeployer.computeCreate2Address( |
23 | | - getGuardedSalt(historyVerifier914432Salt), |
24 | | - ethers.keccak256(HistoryProofVerifier914432__factory.bytecode), |
25 | | - ); |
| 18 | + const historyVerifierAddress = await deployHistoryVerifier(deployer, config.proofBlocksCount); |
26 | 19 |
|
27 | 20 | const proofDirPath = path.join(__dirname, "./proofs", config.proofBlocksCount.toString()); |
28 | 21 |
|
29 | 22 | const proof = getHistoryProofFromFile(proofDirPath); |
30 | 23 | const publicInputs = getHistoryProofPublicInputsFromFile(proofDirPath); |
31 | 24 |
|
32 | 25 | const historicalSPVInitData = HistoricalSPVGateway__factory.createInterface().encodeFunctionData( |
33 | | - "__HistoricalSPVGateway_init(bytes,uint64,uint256,bytes32,(address,bytes32[],bytes))", |
| 26 | + "__HistoricalSPVGateway_init(bytes,uint64,uint32,uint256,bytes32,(address,bytes32[],bytes))", |
34 | 27 | [ |
35 | 28 | config.blockHeader, |
36 | 29 | config.blockHeight, |
| 30 | + config.lastHistoryEpochStartTime, |
37 | 31 | config.cumulativeWork, |
38 | 32 | config.historyBlocksTreeRoot, |
39 | 33 | { |
|
0 commit comments