@cofhe/hardhat-3-plugin 0.8.0 → 1.0.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/CHANGELOG.md +37 -0
- package/dist/{chunk-FDCRLC5K.js → chunk-7CWCMFGX.js} +18 -2
- package/dist/{hre-T3TPXWIY.js → hre-T3ZJJ47F.js} +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/package.json +3 -3
- package/src/deploy.ts +23 -2
- package/src/hooks/hre.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @cofhe/hardhat-3-plugin
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6dcfb7d: ACPs sharing SNAPSHOTs (ctHashes rather than live data) can use the new on-chain ACP Sharing Registry `metadata` field to cite the origin of the snapshotted data (contract address + view-function / event), and the recipient can verify it on-chain. [Docs](https://cofhesdk.fhenix.io/sdk/acp#labelling-a-snapshot-share)
|
|
8
|
+
|
|
9
|
+
**@cofhe/sdk**
|
|
10
|
+
|
|
11
|
+
- `createSharing({ labels })`, `shareOnChain(acp, { labels | metadata })`; labels travel in `export()` / `importShared` as `SharedACP.metadata`.
|
|
12
|
+
- New `client.acp.verifyShareLabels`, `client.acp.getShareFromChain`, and `describeShareMetadata`. `IncomingShare` gains `metadata` and `appKey`.
|
|
13
|
+
- New `acp.app` config option: shares are tagged with the app's key and `getIncomingShares` lists only that app's shares ([docs](https://cofhesdk.fhenix.io/sdk/acp#mark-shares-for-your-app)).
|
|
14
|
+
- `@cofhe/sdk/acps` exports the metadata codec, label builders (`viewFunctionLabel`, `eventLogLabel`, `UNLABELLED`), verifiers, registry readers, `shareAppKey` and `ERC7984_ABI`.
|
|
15
|
+
|
|
16
|
+
**@cofhe/react**
|
|
17
|
+
|
|
18
|
+
- New `useCofheShareLabels`. `useCofheShareOnChain` accepts `{ acp, labels | metadata }`.
|
|
19
|
+
- The inbox shows each share's labels and their verification. [Docs](https://cofhesdk.fhenix.io/react/acp#share-labels)
|
|
20
|
+
|
|
21
|
+
**Mocks and plugins**
|
|
22
|
+
|
|
23
|
+
- `ACPShareRegistry`, `ACPTimestampRevoker` and `Permissioned` are copied verbatim from a pinned cofhe-contracts commit (`pnpm update:cofhe-contracts <commit>`). The share registry is deployed behind `MockERC1967Proxy`.
|
|
24
|
+
- Mocks now need Solidity ≥0.8.25 and `@openzeppelin/contracts-upgradeable` (new Hardhat plugin peer dependency; Foundry users add its remapping).
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 715b220: `cofhe.logMocks: true` now turns on FHE operation logs when the mocks are deployed. It was previously ignored.
|
|
29
|
+
- Updated dependencies [d711ce2]
|
|
30
|
+
- Updated dependencies [d711ce2]
|
|
31
|
+
- Updated dependencies [5a192ee]
|
|
32
|
+
- Updated dependencies [757e448]
|
|
33
|
+
- Updated dependencies [73d5297]
|
|
34
|
+
- Updated dependencies [6dcfb7d]
|
|
35
|
+
- Updated dependencies [8fad647]
|
|
36
|
+
- Updated dependencies [a4fcea7]
|
|
37
|
+
- @cofhe/mock-contracts@1.0.0
|
|
38
|
+
- @cofhe/sdk@1.0.0
|
|
39
|
+
|
|
3
40
|
## 0.8.0
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// src/deploy.ts
|
|
2
|
-
import { createTestClient, custom } from "viem";
|
|
2
|
+
import { createTestClient, custom, encodeFunctionData } from "viem";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { privateKeyToAccount } from "viem/accounts";
|
|
5
5
|
import {
|
|
6
|
+
ACPShareRegistryArtifact,
|
|
6
7
|
MockACLArtifact,
|
|
7
8
|
MockCoFHEAddressBookArtifact,
|
|
8
9
|
MockTaskManagerArtifact,
|
|
@@ -96,7 +97,11 @@ async function deployMocks(ctx, options = {}) {
|
|
|
96
97
|
chain: null
|
|
97
98
|
});
|
|
98
99
|
log("vv", "Default revoker contract set in ACL", 2);
|
|
99
|
-
const
|
|
100
|
+
const acpShareRegistryImpl = await deployVariable(ctx, "ACPShareRegistry", []);
|
|
101
|
+
const acpShareRegistryAddress = await deployVariable(ctx, "MockERC1967Proxy", [
|
|
102
|
+
acpShareRegistryImpl,
|
|
103
|
+
encodeFunctionData({ abi: ACPShareRegistryArtifact.abi, functionName: "initialize", args: [account] })
|
|
104
|
+
]);
|
|
100
105
|
logDeployment("ACPShareRegistry", acpShareRegistryAddress);
|
|
101
106
|
await ctx.walletClient.writeContract({
|
|
102
107
|
address: aclAddress,
|
|
@@ -151,6 +156,17 @@ async function deployMocks(ctx, options = {}) {
|
|
|
151
156
|
account,
|
|
152
157
|
chain: null
|
|
153
158
|
});
|
|
159
|
+
if (options.logMocks) {
|
|
160
|
+
await ctx.walletClient.writeContract({
|
|
161
|
+
address: MOCKS_TASK_MANAGER_ADDRESS,
|
|
162
|
+
abi: MockTaskManagerArtifact.abi,
|
|
163
|
+
functionName: "setLogOps",
|
|
164
|
+
args: [true],
|
|
165
|
+
account,
|
|
166
|
+
chain: null
|
|
167
|
+
});
|
|
168
|
+
log("vv", "FHE operation logs enabled", 2);
|
|
169
|
+
}
|
|
154
170
|
log("v", chalk.bold("cofhe-hardhat-3-plugin :: mocks deployed"), 0);
|
|
155
171
|
if (gasWarning) {
|
|
156
172
|
logEmpty("v");
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getMockContractsNpmPaths,
|
|
4
4
|
mock_expectPlaintext,
|
|
5
5
|
mock_getPlaintext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7CWCMFGX.js";
|
|
7
7
|
import {
|
|
8
8
|
mock_setLoggingEnabled,
|
|
9
9
|
mock_withLogs
|
|
@@ -145,7 +145,8 @@ var hreHooks = {
|
|
|
145
145
|
{ publicClient, walletClient, artifacts: hre.artifacts },
|
|
146
146
|
{
|
|
147
147
|
gasWarning: hre.config.cofhe.gasWarning,
|
|
148
|
-
mocksDeployVerbosity: hre.config.cofhe.mocksDeployVerbosity
|
|
148
|
+
mocksDeployVerbosity: hre.config.cofhe.mocksDeployVerbosity,
|
|
149
|
+
logMocks: hre.config.cofhe.logMocks
|
|
149
150
|
}
|
|
150
151
|
);
|
|
151
152
|
if (hre.config.cofhe.gasSummary && deployedMockContracts.MockTaskManager !== void 0) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
getMockContractsNpmPaths,
|
|
4
4
|
mock_expectPlaintext,
|
|
5
5
|
mock_getPlaintext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7CWCMFGX.js";
|
|
7
7
|
import {
|
|
8
8
|
localcofheFundAccount,
|
|
9
9
|
localcofheFundWalletIfNeeded
|
|
@@ -36,7 +36,7 @@ var plugin = {
|
|
|
36
36
|
id: "@cofhe/hardhat-3-plugin",
|
|
37
37
|
hookHandlers: {
|
|
38
38
|
config: async () => import("./config-VUCAYBHC.js"),
|
|
39
|
-
hre: async () => import("./hre-
|
|
39
|
+
hre: async () => import("./hre-T3ZJJ47F.js")
|
|
40
40
|
},
|
|
41
41
|
tasks: [
|
|
42
42
|
task(TASK_COFHE_USE_FAUCET, "Fund an account via the localcofhe faucet").addOption({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cofhe/hardhat-3-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Hardhat 3 plugin for CoFHE — deploys mock contracts and wires up the hre.cofhe interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"chalk": "4.1.2",
|
|
30
30
|
"viem": "2.38.6",
|
|
31
|
-
"@cofhe/mock-contracts": "0.
|
|
32
|
-
"@cofhe/sdk": "0.
|
|
31
|
+
"@cofhe/mock-contracts": "1.0.0",
|
|
32
|
+
"@cofhe/sdk": "1.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "20.19.15",
|
package/src/deploy.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ArtifactManager } from 'hardhat/types/artifacts';
|
|
2
2
|
import type { PublicClient, WalletClient } from 'viem';
|
|
3
|
-
import { createTestClient, custom } from 'viem';
|
|
3
|
+
import { createTestClient, custom, encodeFunctionData } from 'viem';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
|
+
ACPShareRegistryArtifact,
|
|
8
9
|
MockACLArtifact,
|
|
9
10
|
MockCoFHEAddressBookArtifact,
|
|
10
11
|
MockTaskManagerArtifact,
|
|
@@ -43,6 +44,7 @@ export type DeployedMockContracts = {
|
|
|
43
44
|
export type DeployMocksArgs = {
|
|
44
45
|
gasWarning?: boolean;
|
|
45
46
|
mocksDeployVerbosity?: LogMocksDeploy;
|
|
47
|
+
logMocks?: boolean;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
export type DeployContext = {
|
|
@@ -159,7 +161,12 @@ export async function deployMocks(ctx: DeployContext, options: DeployMocksArgs =
|
|
|
159
161
|
log('vv', 'Default revoker contract set in ACL', 2);
|
|
160
162
|
|
|
161
163
|
// 5c. ACP: on-chain hand-off for sharing ACPs
|
|
162
|
-
|
|
164
|
+
// The production contract (upgradeable): behind a proxy, initialized with the deployer as admin
|
|
165
|
+
const acpShareRegistryImpl = await deployVariable(ctx, 'ACPShareRegistry', []);
|
|
166
|
+
const acpShareRegistryAddress = await deployVariable(ctx, 'MockERC1967Proxy', [
|
|
167
|
+
acpShareRegistryImpl,
|
|
168
|
+
encodeFunctionData({ abi: ACPShareRegistryArtifact.abi, functionName: 'initialize', args: [account] }),
|
|
169
|
+
]);
|
|
163
170
|
logDeployment('ACPShareRegistry', acpShareRegistryAddress);
|
|
164
171
|
await ctx.walletClient.writeContract({
|
|
165
172
|
address: aclAddress,
|
|
@@ -226,6 +233,20 @@ export async function deployMocks(ctx: DeployContext, options: DeployMocksArgs =
|
|
|
226
233
|
chain: null,
|
|
227
234
|
});
|
|
228
235
|
|
|
236
|
+
// The TaskManager is placed with hardhat_setCode, so its `logOps = true` initializer never runs
|
|
237
|
+
// and logging starts off. Turn it on here when the config asks for it.
|
|
238
|
+
if (options.logMocks) {
|
|
239
|
+
await ctx.walletClient.writeContract({
|
|
240
|
+
address: MOCKS_TASK_MANAGER_ADDRESS,
|
|
241
|
+
abi: MockTaskManagerArtifact.abi,
|
|
242
|
+
functionName: 'setLogOps',
|
|
243
|
+
args: [true],
|
|
244
|
+
account,
|
|
245
|
+
chain: null,
|
|
246
|
+
});
|
|
247
|
+
log('vv', 'FHE operation logs enabled', 2);
|
|
248
|
+
}
|
|
249
|
+
|
|
229
250
|
log('v', chalk.bold('cofhe-hardhat-3-plugin :: mocks deployed'), 0);
|
|
230
251
|
|
|
231
252
|
if (gasWarning) {
|
package/src/hooks/hre.ts
CHANGED