@cofhe/foundry-plugin 0.0.0-alpha-20260922112054 → 0.0.0-alpha-20261005111047
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/contracts/CofheClient.sol +1 -1
- package/contracts/CofheTest.sol +14 -4
- package/package.json +3 -3
|
@@ -50,7 +50,7 @@ contract CofheClient is Test {
|
|
|
50
50
|
bool private _connected;
|
|
51
51
|
|
|
52
52
|
constructor() {
|
|
53
|
-
mockTaskManager = MockTaskManager(
|
|
53
|
+
mockTaskManager = MockTaskManager(address(Common.tm()));
|
|
54
54
|
mockAcl = MockACL(address(mockTaskManager.acl()));
|
|
55
55
|
mockZkVerifier = MockZkVerifier(ZK_VERIFIER_ADDRESS);
|
|
56
56
|
mockZkVerifierSigner = MockZkVerifierSigner(ZK_VERIFIER_SIGNER_ADDRESS);
|
package/contracts/CofheTest.sol
CHANGED
|
@@ -3,6 +3,7 @@ pragma solidity ^0.8.13;
|
|
|
3
3
|
|
|
4
4
|
import { Test } from 'forge-std/Test.sol';
|
|
5
5
|
import '@fhenixprotocol/cofhe-contracts/FHE.sol';
|
|
6
|
+
import { MockCoFHEAddressBook } from '@cofhe/mock-contracts/contracts/MockCoFHEAddressBook.sol';
|
|
6
7
|
import { MockTaskManager } from '@cofhe/mock-contracts/contracts/MockTaskManager.sol';
|
|
7
8
|
import { MockACL } from '@cofhe/mock-contracts/contracts/MockACL.sol';
|
|
8
9
|
import { ACPTimestampRevoker } from '@cofhe/mock-contracts/contracts/ACPTimestampRevoker.sol';
|
|
@@ -21,6 +22,7 @@ import {
|
|
|
21
22
|
/// @dev Inherit this contract and call `deployMocks()` in your `setUp()` function.
|
|
22
23
|
/// Use `createCofheClient()` to obtain a connected client instance.
|
|
23
24
|
abstract contract CofheTest is Test {
|
|
25
|
+
MockCoFHEAddressBook public mockAddressBook;
|
|
24
26
|
MockTaskManager public mockTaskManager;
|
|
25
27
|
MockACL public mockAcl;
|
|
26
28
|
ACPTimestampRevoker public acpRevoker;
|
|
@@ -31,6 +33,7 @@ abstract contract CofheTest is Test {
|
|
|
31
33
|
MockThresholdNetworkSigner public mockThresholdNetworkSigner;
|
|
32
34
|
|
|
33
35
|
// Keep in sync with `packages/sdk/core/consts.ts`
|
|
36
|
+
address constant MOCKS_TASK_MANAGER_ADDRESS = 0x0000000000000000000000000000000000005000;
|
|
34
37
|
address constant ZK_VERIFIER_ADDRESS = 0x0000000000000000000000000000000000005001;
|
|
35
38
|
address constant THRESHOLD_NETWORK_ADDRESS = 0x0000000000000000000000000000000000005002;
|
|
36
39
|
|
|
@@ -42,20 +45,27 @@ abstract contract CofheTest is Test {
|
|
|
42
45
|
|
|
43
46
|
/// @notice Deploys all mock contracts and wires them together, mirroring the Hardhat plugin's deployment order.
|
|
44
47
|
function deployMocks() public {
|
|
48
|
+
// 0. Address Book (FHE.sol resolves the Task Manager through it)
|
|
49
|
+
deployCodeTo('MockCoFHEAddressBook.sol:MockCoFHEAddressBook', COFHE_ADDRESS_BOOK);
|
|
50
|
+
mockAddressBook = MockCoFHEAddressBook(COFHE_ADDRESS_BOOK);
|
|
51
|
+
vm.label(address(mockAddressBook), 'MockCoFHEAddressBook');
|
|
52
|
+
|
|
45
53
|
// 1. Task Manager
|
|
46
|
-
deployCodeTo('MockTaskManager.sol:MockTaskManager',
|
|
47
|
-
mockTaskManager = MockTaskManager(
|
|
54
|
+
deployCodeTo('MockTaskManager.sol:MockTaskManager', MOCKS_TASK_MANAGER_ADDRESS);
|
|
55
|
+
mockTaskManager = MockTaskManager(MOCKS_TASK_MANAGER_ADDRESS);
|
|
56
|
+
mockAddressBook.setTm(TASK_MANAGER_ID, MOCKS_TASK_MANAGER_ADDRESS);
|
|
48
57
|
mockTaskManager.initialize(TM_ADMIN);
|
|
49
58
|
mockTaskManager.setLogOps(false);
|
|
50
59
|
// Exclude mock-only plaintext replication from gas metering so reported gas is closer
|
|
51
60
|
// to the real task manager. Requires cheatcode access, which etched contracts don't
|
|
52
61
|
// inherit from the test contract.
|
|
53
|
-
vm.allowCheatcodes(
|
|
62
|
+
vm.allowCheatcodes(MOCKS_TASK_MANAGER_ADDRESS);
|
|
54
63
|
mockTaskManager.setMockGasExcluded(true);
|
|
55
64
|
vm.label(address(mockTaskManager), 'MockTaskManager');
|
|
56
65
|
|
|
57
66
|
// 2. ACL (non-fixed deploy so constructor runs and EIP712 domain is set)
|
|
58
67
|
mockAcl = new MockACL();
|
|
68
|
+
mockAcl.setTaskManager(address(mockTaskManager));
|
|
59
69
|
vm.label(address(mockAcl), 'MockACL');
|
|
60
70
|
|
|
61
71
|
// ACP (ACP V3): default revoker (verification inherited by the ACL)
|
|
@@ -93,7 +103,7 @@ abstract contract CofheTest is Test {
|
|
|
93
103
|
// 7. Threshold Network
|
|
94
104
|
deployCodeTo('MockThresholdNetwork.sol:MockThresholdNetwork', THRESHOLD_NETWORK_ADDRESS);
|
|
95
105
|
mockThresholdNetwork = MockThresholdNetwork(THRESHOLD_NETWORK_ADDRESS);
|
|
96
|
-
mockThresholdNetwork.initialize(
|
|
106
|
+
mockThresholdNetwork.initialize(address(mockTaskManager), address(mockAcl));
|
|
97
107
|
vm.label(address(mockThresholdNetwork), 'MockThresholdNetwork');
|
|
98
108
|
|
|
99
109
|
// 8. Threshold Network Signer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cofhe/foundry-plugin",
|
|
3
|
-
"version": "0.0.0-alpha-
|
|
3
|
+
"version": "0.0.0-alpha-20261005111047",
|
|
4
4
|
"description": "Foundry plugin for CoFHE — Write and test FHE enabled contracts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"fhenix"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@fhenixprotocol/cofhe-contracts": "0.
|
|
27
|
+
"@fhenixprotocol/cofhe-contracts": "file:../../vendor/fhenixprotocol-cofhe-contracts-0.4.0.tgz",
|
|
28
28
|
"@openzeppelin/contracts": "5.4.0",
|
|
29
|
-
"@cofhe/mock-contracts": "0.0.0-alpha-
|
|
29
|
+
"@cofhe/mock-contracts": "0.0.0-alpha-20261005111047"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"forge-std": "github:foundry-rs/forge-std#c0f966cb111f621bfb283b2a388bc7be18953bba",
|