@cofhe/foundry-plugin 0.0.0-beta-20260415104511 → 0.0.0-beta-20260417095940
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.
|
@@ -9,14 +9,14 @@ import { DECRYPT_RESULT_SIGNER_PRIVATE_KEY } from '@cofhe/mock-contracts/contrac
|
|
|
9
9
|
* @dev Generates valid signatures for decrypt results.
|
|
10
10
|
* Uses vm.sign to generate the signatures (only available in foundry tests).
|
|
11
11
|
* Mirrors the SDK's cofheMocksDecryptForTx.ts signing logic:
|
|
12
|
-
* keccak256(abi.encodePacked(
|
|
12
|
+
* keccak256(abi.encodePacked(decryptedValue, encType, chainId, ctHash)) signed with DECRYPT_RESULT_SIGNER_PRIVATE_KEY
|
|
13
13
|
*/
|
|
14
14
|
contract MockThresholdNetworkSigner is Test {
|
|
15
|
-
function signDecryptResult(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
function signDecryptResult(uint256 ctHash, uint256 decryptedValue) public view returns (bytes memory signature) {
|
|
16
|
+
uint8 encryptionType = uint8((ctHash >> 8) & 0x7f);
|
|
17
|
+
bytes32 messageHash = keccak256(
|
|
18
|
+
abi.encodePacked(decryptedValue, uint32(encryptionType), uint64(block.chainid), ctHash)
|
|
19
|
+
);
|
|
20
20
|
|
|
21
21
|
(uint8 v, bytes32 r, bytes32 s) = vm.sign(DECRYPT_RESULT_SIGNER_PRIVATE_KEY, messageHash);
|
|
22
22
|
signature = abi.encodePacked(r, s, v);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cofhe/foundry-plugin",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-20260417095940",
|
|
4
4
|
"description": "Foundry plugin for CoFHE — Write and test FHE enabled contracts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fhenixprotocol/cofhe-contracts": "0.1.0",
|
|
28
28
|
"@openzeppelin/contracts": "^5.0.0",
|
|
29
|
-
"@cofhe/mock-contracts": "0.0.0-beta-
|
|
29
|
+
"@cofhe/mock-contracts": "0.0.0-beta-20260417095940"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"forge-std": "github:foundry-rs/forge-std"
|