@cofhe/hardhat-plugin 0.7.1 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // src/index.ts
10
- import chalk3 from "chalk";
10
+ import chalk4 from "chalk";
11
11
  import path from "path";
12
12
  import fs from "fs";
13
13
  import "viem";
@@ -82,26 +82,28 @@ import "hardhat/types";
82
82
  import chalk from "chalk";
83
83
  import { Wallet } from "ethers";
84
84
  import {
85
+ MockCoFHEAddressBookArtifact,
85
86
  MockTaskManagerArtifact,
86
87
  MockACLArtifact,
87
88
  ACPTimestampRevokerArtifact,
88
89
  ACPShareRegistryArtifact,
90
+ MockERC1967ProxyArtifact,
89
91
  MockZkVerifierArtifact,
90
92
  MockThresholdNetworkArtifact
91
93
  } from "@cofhe/mock-contracts";
92
94
  import {
93
- TASK_MANAGER_ADDRESS as TASK_MANAGER_ADDRESS2,
95
+ TASK_MANAGER_ID,
94
96
  MOCKS_ZK_VERIFIER_SIGNER_ADDRESS,
95
97
  MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY,
96
98
  MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY
97
99
  } from "@cofhe/sdk";
98
100
 
99
101
  // src/utils.ts
100
- import { TASK_MANAGER_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS } from "@cofhe/sdk";
102
+ import { MOCKS_TASK_MANAGER_ADDRESS, MOCKS_ZK_VERIFIER_ADDRESS } from "@cofhe/sdk";
101
103
  import { expect } from "chai";
102
104
  import { ethers } from "ethers";
103
105
  import "@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider";
104
- var deployMockContractFromArtifact = async (hre, artifact) => {
106
+ var deployMockContractFromArtifact = async (hre, artifact, constructorArgs = []) => {
105
107
  const hardhatArtifact = await hre.artifacts.readArtifact(artifact.contractName);
106
108
  if (artifact.isFixed) {
107
109
  await hre.network.provider.send("hardhat_setCode", [artifact.fixedAddress, hardhatArtifact.deployedBytecode]);
@@ -109,7 +111,7 @@ var deployMockContractFromArtifact = async (hre, artifact) => {
109
111
  }
110
112
  const [signer] = await hre.ethers.getSigners();
111
113
  const factory = new hre.ethers.ContractFactory(hardhatArtifact.abi, hardhatArtifact.bytecode, signer);
112
- const contract = await factory.deploy();
114
+ const contract = await factory.deploy(...constructorArgs);
113
115
  await contract.waitForDeployment();
114
116
  return contract;
115
117
  };
@@ -122,7 +124,7 @@ var getFixedMockContract = async (hre, artifact) => {
122
124
  };
123
125
  var mock_checkIsTestnet = async (fnName, provider) => {
124
126
  const bytecode = await provider.getCode(MOCKS_ZK_VERIFIER_ADDRESS);
125
- const isTestnet = bytecode.length === 0;
127
+ const isTestnet = !bytecode || bytecode.length <= 2;
126
128
  if (isTestnet) {
127
129
  console.log(`${fnName} - skipped on non-testnet chain`);
128
130
  }
@@ -132,7 +134,7 @@ var mock_getPlaintext = async (provider, ctHash) => {
132
134
  if (await mock_checkIsTestnet(mock_getPlaintext.name, provider))
133
135
  return;
134
136
  const taskManager = new ethers.Contract(
135
- TASK_MANAGER_ADDRESS,
137
+ MOCKS_TASK_MANAGER_ADDRESS,
136
138
  ["function mockStorage(uint256) view returns (uint256)"],
137
139
  provider
138
140
  );
@@ -143,7 +145,7 @@ var mock_getPlaintextExists = async (provider, ctHash) => {
143
145
  if (await mock_checkIsTestnet(mock_getPlaintextExists.name, provider))
144
146
  return;
145
147
  const taskManager = new ethers.Contract(
146
- TASK_MANAGER_ADDRESS,
148
+ MOCKS_TASK_MANAGER_ADDRESS,
147
149
  ["function inMockStorage(uint256) view returns (bool)"],
148
150
  provider
149
151
  );
@@ -172,20 +174,30 @@ var deployMocks = async (hre, options = {
172
174
  }
173
175
  await hre.run("compile", { quiet: true });
174
176
  log("vv", chalk.bold("cofhe-hardhat-plugin :: deploy mocks"), 0);
177
+ const addressBook = await deployMockAddressBook(hre);
178
+ logDeployment("MockCoFHEAddressBook", await addressBook.getAddress());
175
179
  const taskManager = await deployMockTaskManager(hre);
176
180
  logDeployment("MockTaskManager", await taskManager.getAddress());
181
+ await registerTaskManager(addressBook, taskManager);
182
+ log("vv", "TaskManager registered in CoFHEAddressBook", 2);
177
183
  const acl = await deployMockACL(hre);
178
184
  logDeployment("MockACL", await acl.getAddress());
179
185
  const acpRevoker = await deployMockContractFromArtifact(hre, ACPTimestampRevokerArtifact);
180
186
  logDeployment("ACPTimestampRevoker", await acpRevoker.getAddress());
181
187
  await (await acl.setDefaultRevokerContract(await acpRevoker.getAddress())).wait();
182
188
  log("vv", "Default revoker contract set in ACL", 2);
183
- const acpShareRegistry = await deployMockContractFromArtifact(hre, ACPShareRegistryArtifact);
189
+ const acpShareRegistryImpl = await deployMockContractFromArtifact(hre, ACPShareRegistryArtifact);
190
+ const [registryAdmin] = await hre.ethers.getSigners();
191
+ const acpShareRegistryProxy = await deployMockContractFromArtifact(hre, MockERC1967ProxyArtifact, [
192
+ await acpShareRegistryImpl.getAddress(),
193
+ acpShareRegistryImpl.interface.encodeFunctionData("initialize", [registryAdmin.address])
194
+ ]);
195
+ const acpShareRegistry = acpShareRegistryImpl.attach(await acpShareRegistryProxy.getAddress());
184
196
  logDeployment("ACPShareRegistry", await acpShareRegistry.getAddress());
185
197
  await (await acl.setShareRegistry(await acpShareRegistry.getAddress())).wait();
186
198
  log("vv", "Share registry set in ACL", 2);
187
199
  await linkTaskManagerAndACL(taskManager, acl);
188
- log("vv", "ACL address set in TaskManager", 2);
200
+ log("vv", "ACL address set in TaskManager, TaskManager address set in ACL", 2);
189
201
  await setVerifierSigner(taskManager);
190
202
  log("vv", "Verifier signer set", 2);
191
203
  await setDecryptResultSigner(taskManager);
@@ -196,13 +208,13 @@ var deployMocks = async (hre, options = {
196
208
  log("vv", `ETH balance: ${zkVerifierSignerBalance.toString()}`, 2);
197
209
  const zkVerifier = await deployMockZkVerifier(hre);
198
210
  logDeployment("MockZkVerifier", await zkVerifier.getAddress());
199
- const thresholdNetwork = await deployMockThresholdNetwork(hre, acl);
211
+ const thresholdNetwork = await deployMockThresholdNetwork(hre, taskManager, acl);
200
212
  logDeployment("MockThresholdNetwork", await thresholdNetwork.getAddress());
201
213
  log("v", chalk.bold("cofhe-hardhat-plugin :: mocks deployed"), 0);
202
214
  if (options.gasWarning) {
203
215
  logEmpty("v");
204
216
  logWarning(
205
- "When using mocks, FHE operations (eg FHE.add / FHE.mul) report a higher gas price due to additional on-chain mocking logic. Deploy your contracts on a testnet chain to check the true gas costs.\n(Disable this warning by setting 'cofhe.gasWarning: false' in your hardhat config)",
217
+ "When using mocks, FHE operations (eg FHE.add / FHE.mul) consume extra gas replicating off-chain CoFHE work on-chain. Use hre.cofhe.getAdjustedGasUsed(receipt) or set 'cofhe.gasSummary: true' to see gas numbers with that overhead excluded.\n(Disable this warning by setting 'cofhe.gasWarning: false' in your hardhat config)",
206
218
  0
207
219
  );
208
220
  }
@@ -211,11 +223,25 @@ var deployMocks = async (hre, options = {
211
223
  var getIsHardhat = async (hre) => {
212
224
  return hre.network.name === "hardhat";
213
225
  };
226
+ var deployMockAddressBook = async (hre) => {
227
+ const addressBook = await deployMockContractFromArtifact(hre, MockCoFHEAddressBookArtifact);
228
+ const bookExists = await addressBook.exists();
229
+ if (!bookExists) {
230
+ throw new Error("MockCoFHEAddressBook does not exist");
231
+ }
232
+ return addressBook;
233
+ };
234
+ var registerTaskManager = async (addressBook, taskManager) => {
235
+ const setTmTx = await addressBook.setTm(TASK_MANAGER_ID, await taskManager.getAddress());
236
+ await setTmTx.wait();
237
+ };
214
238
  var deployMockTaskManager = async (hre) => {
215
239
  const [signer] = await hre.ethers.getSigners();
216
240
  const taskManager = await deployMockContractFromArtifact(hre, MockTaskManagerArtifact);
217
241
  const initTx = await taskManager.initialize(signer.address);
218
242
  await initTx.wait();
243
+ const securityZonesTx = await taskManager.setSecurityZones(0, 1);
244
+ await securityZonesTx.wait();
219
245
  const tmExists = await taskManager.exists();
220
246
  if (!tmExists) {
221
247
  throw new Error("MockTaskManager does not exist");
@@ -244,6 +270,8 @@ var linkTaskManagerAndACL = async (taskManager, acl) => {
244
270
  const aclAddress = await acl.getAddress();
245
271
  const linkAclTx = await taskManager.setACLContract(aclAddress);
246
272
  await linkAclTx.wait();
273
+ const linkTaskManagerTx = await acl.setTaskManager(await taskManager.getAddress());
274
+ await linkTaskManagerTx.wait();
247
275
  };
248
276
  var setVerifierSigner = async (taskManager) => {
249
277
  const signer = new Wallet(MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY);
@@ -263,9 +291,9 @@ var deployMockZkVerifier = async (hre) => {
263
291
  }
264
292
  return zkVerifier;
265
293
  };
266
- var deployMockThresholdNetwork = async (hre, acl) => {
294
+ var deployMockThresholdNetwork = async (hre, taskManager, acl) => {
267
295
  const thresholdNetwork = await deployMockContractFromArtifact(hre, MockThresholdNetworkArtifact);
268
- const initTx = await thresholdNetwork.initialize(TASK_MANAGER_ADDRESS2, await acl.getAddress());
296
+ const initTx = await thresholdNetwork.initialize(await taskManager.getAddress(), await acl.getAddress());
269
297
  await initTx.wait();
270
298
  const exists = await thresholdNetwork.exists();
271
299
  if (!exists) {
@@ -349,10 +377,159 @@ var mock_withLogs = async (hre, closureName, closure) => {
349
377
  }
350
378
  };
351
379
 
380
+ // src/gas.ts
381
+ import chalk3 from "chalk";
382
+ import { ethers as ethers2 } from "ethers";
383
+ import { MOCKS_TASK_MANAGER_ADDRESS as MOCKS_TASK_MANAGER_ADDRESS2 } from "@cofhe/sdk";
384
+ var MOCK_GAS_CONSUMED_TOPIC = ethers2.id("MockGasConsumed(uint256)");
385
+ var mock_getAdjustedGasBreakdown = (receipt) => {
386
+ let mockGas = 0n;
387
+ let mockGasEvents = 0;
388
+ for (const log2 of receipt.logs ?? []) {
389
+ if (log2.address.toLowerCase() === MOCKS_TASK_MANAGER_ADDRESS2.toLowerCase() && log2.topics[0] === MOCK_GAS_CONSUMED_TOPIC) {
390
+ mockGas += BigInt(log2.data);
391
+ mockGasEvents += 1;
392
+ }
393
+ }
394
+ const gasUsed = BigInt(receipt.gasUsed);
395
+ return { gasUsed, mockGas, adjustedGasUsed: mockGas > gasUsed ? 0n : gasUsed - mockGas, mockGasEvents };
396
+ };
397
+ var mock_getAdjustedGasUsed = (receipt) => mock_getAdjustedGasBreakdown(receipt).adjustedGasUsed;
398
+ var shortAddress = (address) => `${address.slice(0, 6)}..${address.slice(-4)}`;
399
+ var buildSelectorNameMap = async (hre) => {
400
+ const selectorNames = /* @__PURE__ */ new Map();
401
+ for (const fqn of await hre.artifacts.getAllFullyQualifiedNames()) {
402
+ try {
403
+ const artifact = await hre.artifacts.readArtifact(fqn);
404
+ const iface = new ethers2.Interface(artifact.abi);
405
+ iface.forEachFunction((fn) => {
406
+ if (!selectorNames.has(fn.selector))
407
+ selectorNames.set(fn.selector, fn.format("sighash"));
408
+ });
409
+ } catch {
410
+ }
411
+ }
412
+ return selectorNames;
413
+ };
414
+ var buildAddressNameMap = async (hre, addresses) => {
415
+ const codeToName = /* @__PURE__ */ new Map();
416
+ for (const fqn of await hre.artifacts.getAllFullyQualifiedNames()) {
417
+ try {
418
+ const artifact = await hre.artifacts.readArtifact(fqn);
419
+ if (artifact.deployedBytecode && artifact.deployedBytecode !== "0x") {
420
+ codeToName.set(artifact.deployedBytecode.toLowerCase(), artifact.contractName);
421
+ }
422
+ } catch {
423
+ }
424
+ }
425
+ const addressNames = /* @__PURE__ */ new Map();
426
+ for (const address of addresses) {
427
+ try {
428
+ const code = await hre.network.provider.send("eth_getCode", [address, "latest"]);
429
+ addressNames.set(address, codeToName.get(code.toLowerCase()) ?? shortAddress(address));
430
+ } catch {
431
+ addressNames.set(address, shortAddress(address));
432
+ }
433
+ }
434
+ return addressNames;
435
+ };
436
+ var printMockGasSummary = async (hre) => {
437
+ if (hre.network.name !== "hardhat")
438
+ return;
439
+ let logs;
440
+ try {
441
+ logs = await hre.network.provider.send("eth_getLogs", [
442
+ { fromBlock: "0x0", toBlock: "latest", address: MOCKS_TASK_MANAGER_ADDRESS2, topics: [MOCK_GAS_CONSUMED_TOPIC] }
443
+ ]);
444
+ } catch {
445
+ return;
446
+ }
447
+ if (!logs || logs.length === 0)
448
+ return;
449
+ const mockGasPerTx = /* @__PURE__ */ new Map();
450
+ for (const log2 of logs) {
451
+ mockGasPerTx.set(log2.transactionHash, (mockGasPerTx.get(log2.transactionHash) ?? 0n) + BigInt(log2.data));
452
+ }
453
+ const aggregates = /* @__PURE__ */ new Map();
454
+ for (const [txHash, mockGas] of mockGasPerTx) {
455
+ try {
456
+ const receipt = await hre.network.provider.send("eth_getTransactionReceipt", [txHash]);
457
+ const tx = await hre.network.provider.send("eth_getTransactionByHash", [txHash]);
458
+ if (!receipt)
459
+ continue;
460
+ const target = tx?.to ?? receipt.contractAddress;
461
+ if (!target)
462
+ continue;
463
+ const to = ethers2.getAddress(target);
464
+ const selector = tx?.to ? (tx.input ?? "0x").slice(0, 10) : "(deployment)";
465
+ const key = `${to}:${selector}`;
466
+ const aggregate = aggregates.get(key) ?? { to, selector, calls: 0, totalGasUsed: 0n, totalMockGas: 0n };
467
+ aggregate.calls += 1;
468
+ aggregate.totalGasUsed += BigInt(receipt.gasUsed);
469
+ aggregate.totalMockGas += mockGas;
470
+ aggregates.set(key, aggregate);
471
+ } catch {
472
+ }
473
+ }
474
+ if (aggregates.size === 0)
475
+ return;
476
+ const selectorNames = await buildSelectorNameMap(hre);
477
+ const addressNames = await buildAddressNameMap(hre, [...new Set([...aggregates.values()].map((a) => a.to))]);
478
+ const merged = /* @__PURE__ */ new Map();
479
+ for (const a of aggregates.values()) {
480
+ const contract = addressNames.get(a.to) ?? shortAddress(a.to);
481
+ const method = selectorNames.get(a.selector) ?? a.selector;
482
+ const key = `${contract}:${method}`;
483
+ const row = merged.get(key) ?? { contract, method, calls: 0, totalGasUsed: 0n, totalMockGas: 0n };
484
+ row.calls += a.calls;
485
+ row.totalGasUsed += a.totalGasUsed;
486
+ row.totalMockGas += a.totalMockGas;
487
+ merged.set(key, row);
488
+ }
489
+ const rows = [...merged.values()].map((r) => {
490
+ const avgGasUsed = r.totalGasUsed / BigInt(r.calls);
491
+ const avgMockGas = r.totalMockGas / BigInt(r.calls);
492
+ return {
493
+ contract: r.contract,
494
+ method: r.method,
495
+ calls: r.calls,
496
+ avgGasUsed,
497
+ avgAdjusted: avgMockGas > avgGasUsed ? 0n : avgGasUsed - avgMockGas,
498
+ overheadPct: avgGasUsed === 0n ? 0 : Math.min(100, Number(avgMockGas * 100n / avgGasUsed))
499
+ };
500
+ }).sort((a, b) => a.contract.localeCompare(b.contract) || a.method.localeCompare(b.method));
501
+ const headers = ["Contract", "Method", "Calls", "Avg gas (mocks)", "Avg gas (adjusted)", "Mock overhead"];
502
+ const cells = rows.map((r) => [
503
+ r.contract,
504
+ r.method,
505
+ String(r.calls),
506
+ r.avgGasUsed.toLocaleString(),
507
+ r.avgAdjusted.toLocaleString(),
508
+ `${r.overheadPct}%`
509
+ ]);
510
+ const widths = headers.map((h, i) => Math.max(h.length, ...cells.map((row) => row[i].length)));
511
+ const line = (row) => `\u2502 ${row.map((cell, i) => cell.padEnd(widths[i])).join(" \u2502 ")} \u2502`;
512
+ const divider = (l, m, r) => `${l}${widths.map((w) => "\u2500".repeat(w + 2)).join(m)}${r}`;
513
+ console.log("");
514
+ console.log(chalk3.bold("[COFHE-MOCKS] Gas summary") + chalk3.dim(" \u2014 adjusted \u2248 cost excluding mock-only overhead"));
515
+ console.log(divider("\u250C", "\u252C", "\u2510"));
516
+ console.log(line(headers));
517
+ console.log(divider("\u251C", "\u253C", "\u2524"));
518
+ for (const row of cells)
519
+ console.log(line(row));
520
+ console.log(divider("\u2514", "\u2534", "\u2518"));
521
+ console.log(
522
+ chalk3.dim(
523
+ "Raw numbers include on-chain replication of off-chain CoFHE work; adjusted numbers estimate real-network cost. estimateGas remains unadjusted."
524
+ )
525
+ );
526
+ };
527
+
352
528
  // src/index.ts
353
529
  import { hardhat } from "@cofhe/sdk/chains";
354
530
  import {
355
531
  MockThresholdNetworkArtifact as MockThresholdNetworkArtifact2,
532
+ MockCoFHEAddressBookArtifact as MockCoFHEAddressBookArtifact2,
356
533
  MockTaskManagerArtifact as MockTaskManagerArtifact3,
357
534
  MockZkVerifierArtifact as MockZkVerifierArtifact2
358
535
  } from "@cofhe/mock-contracts";
@@ -393,23 +570,22 @@ subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (taskArgs, hre,
393
570
  return [.../* @__PURE__ */ new Set([...existing, stubPath])];
394
571
  });
395
572
  extendConfig((config, userConfig) => {
396
- if (userConfig.networks && userConfig.networks.localcofhe) {
397
- return;
573
+ if (!userConfig.networks?.localcofhe) {
574
+ config.networks.localcofhe = {
575
+ gas: "auto",
576
+ gasMultiplier: 1.2,
577
+ gasPrice: "auto",
578
+ timeout: 1e4,
579
+ httpHeaders: {},
580
+ url: "http://127.0.0.1:42069",
581
+ accounts: [
582
+ "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
583
+ "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
584
+ "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
585
+ "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
586
+ ]
587
+ };
398
588
  }
399
- config.networks.localcofhe = {
400
- gas: "auto",
401
- gasMultiplier: 1.2,
402
- gasPrice: "auto",
403
- timeout: 1e4,
404
- httpHeaders: {},
405
- url: "http://127.0.0.1:42069",
406
- accounts: [
407
- "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
408
- "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
409
- "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
410
- "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
411
- ]
412
- };
413
589
  if (!userConfig.networks?.["eth-sepolia"]) {
414
590
  config.networks["eth-sepolia"] = {
415
591
  url: process.env.SEPOLIA_RPC_URL ?? "https://ethereum-sepolia.publicnode.com",
@@ -437,6 +613,7 @@ extendConfig((config, userConfig) => {
437
613
  config.cofhe = {
438
614
  logMocks: userConfig.cofhe?.logMocks ?? false,
439
615
  gasWarning: userConfig.cofhe?.gasWarning ?? false,
616
+ gasSummary: userConfig.cofhe?.gasSummary ?? false,
440
617
  mocksDeployVerbosity: userConfig.cofhe?.mocksDeployVerbosity ?? "v"
441
618
  };
442
619
  });
@@ -444,18 +621,18 @@ task(TASK_COFHE_USE_FAUCET, "Fund an account from the funder").addOptionalParam(
444
621
  const { network } = hre;
445
622
  const { name: networkName } = network;
446
623
  if (networkName !== "localcofhe") {
447
- console.info(chalk3.yellow(`Programmatic faucet only supported for localcofhe`));
624
+ console.info(chalk4.yellow(`Programmatic faucet only supported for localcofhe`));
448
625
  return;
449
626
  }
450
627
  if (!address) {
451
- console.info(chalk3.red(`Failed to get address to fund`));
628
+ console.info(chalk4.red(`Failed to get address to fund`));
452
629
  return;
453
630
  }
454
- console.info(chalk3.green(`Getting funds from faucet for ${address}`));
631
+ console.info(chalk4.green(`Getting funds from faucet for ${address}`));
455
632
  try {
456
633
  await localcofheFundAccount(hre, address);
457
634
  } catch (e) {
458
- console.info(chalk3.red(`failed to get funds from localcofhe for ${address}: ${e}`));
635
+ console.info(chalk4.red(`failed to get funds from localcofhe for ${address}: ${e}`));
459
636
  }
460
637
  });
461
638
  task(TASK_COFHE_MOCKS_DEPLOY, "Deploys the mock contracts on the Hardhat network").setAction(
@@ -478,7 +655,11 @@ task(TASK_TEST, "Deploy mock contracts on hardhat").setAction(async ({}, hre, ru
478
655
  mocksDeployVerbosity: hre.config.cofhe.mocksDeployVerbosity
479
656
  });
480
657
  }
481
- return runSuper();
658
+ const result = await runSuper();
659
+ if (hre.config.cofhe.gasSummary) {
660
+ await printMockGasSummary(hre);
661
+ }
662
+ return result;
482
663
  });
483
664
  task(TASK_NODE, "Deploy mock contracts on hardhat").setAction(async ({}, hre, runSuper) => {
484
665
  const skipAutoDeploy = (() => {
@@ -544,6 +725,8 @@ extendEnvironment((hre) => {
544
725
  });
545
726
  return client;
546
727
  },
728
+ getAdjustedGasUsed: mock_getAdjustedGasUsed,
729
+ getAdjustedGasBreakdown: mock_getAdjustedGasBreakdown,
547
730
  mocks: {
548
731
  withLogs: async (closureName, closure) => {
549
732
  return mock_withLogs(hre, closureName, closure);
@@ -565,6 +748,7 @@ extendEnvironment((hre) => {
565
748
  const [signer] = await hre.ethers.getSigners();
566
749
  return mock_expectPlaintext(signer.provider, ctHash, expectedValue);
567
750
  },
751
+ getMockCoFHEAddressBook: async () => getFixedMockContract(hre, MockCoFHEAddressBookArtifact2),
568
752
  getMockTaskManager: async () => getFixedMockContract(hre, MockTaskManagerArtifact3),
569
753
  getMockACL: async () => {
570
754
  const taskManager = await getFixedMockContract(hre, MockTaskManagerArtifact3);
@@ -578,6 +762,7 @@ extendEnvironment((hre) => {
578
762
  };
579
763
  });
580
764
  export {
765
+ MOCK_GAS_CONSUMED_TOPIC,
581
766
  TASK_COFHE_MOCKS_DEPLOY,
582
767
  TASK_COFHE_MOCKS_SET_LOG_OPS,
583
768
  TASK_COFHE_USE_FAUCET,
@@ -588,9 +773,12 @@ export {
588
773
  localcofheFundAccount,
589
774
  localcofheFundWalletIfNeeded,
590
775
  mock_expectPlaintext,
776
+ mock_getAdjustedGasBreakdown,
777
+ mock_getAdjustedGasUsed,
591
778
  mock_getPlaintext,
592
779
  mock_getPlaintextExists,
593
780
  mock_setLoggingEnabled,
594
- mock_withLogs
781
+ mock_withLogs,
782
+ printMockGasSummary
595
783
  };
596
784
  //# sourceMappingURL=index.mjs.map