Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/mock-contracts/contracts/MockCoFHE.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import { FunctionId, Utils } from '@fhenixprotocol/cofhe-contracts/ICofhe.sol';
import { console } from 'hardhat/console.sol';

address constant ZK_VERIFIER_SIGNER_ADDRESS = 0x6E12D8C87503D4287c294f2Fdef96ACd9DFf6bd2;
uint256 constant ZK_VERIFIER_SIGNER_PRIVATE_KEY = 49099792800763675079532137679706322989817545357788440619111868498148356080914;
// Remove the private key constants, the addresses are sufficient for mock verification, Private keys should never exist in Solidity source.


address constant DECRYPT_RESULT_SIGNER_ADDRESS = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8;
uint256 constant DECRYPT_RESULT_SIGNER_PRIVATE_KEY = 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d;
// Remove the private key constants, the addresses are sufficient for mock verification, Private keys should never exist in Solidity source.
Comment thread
cursor[bot] marked this conversation as resolved.


/**
* @dev Mock implementation of the CoFHE coprocessor, used to test FHE ops in isolation.
Expand Down
6 changes: 2 additions & 4 deletions packages/sdk/core/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ export const MOCKS_THRESHOLD_NETWORK_ADDRESS = '0x000000000000000000000000000000
export const TEST_BED_ADDRESS = '0x0000000000000000000000000000000000005003' as const;

/** Private key for the Mock ZK Verifier signer account */
export const MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY =
'0x6C8D7F768A6BB4AAFE85E8A2F5A9680355239C7E14646ED62B044E39DE154512' as const;
export const MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY = process.env.MOCK_ZK_SIGNER_PK;

/** Address for the Mock ZK Verifier signer account */
export const MOCKS_ZK_VERIFIER_SIGNER_ADDRESS = '0x6E12D8C87503D4287c294f2Fdef96ACd9DFf6bd2' as const;

/** Private key for the Mock decrypt result signer account */
export const MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY =
'0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d' as const;
export const MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY = process.env.MOCK_DECRYPT_SIGNER_PK;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable keys break mock SDK functions

High Severity

MOCKS_ZK_VERIFIER_SIGNER_PRIVATE_KEY and MOCKS_DECRYPT_RESULT_SIGNER_PRIVATE_KEY are now process.env lookups that evaluate to string | undefined. These values are passed directly to viem's privateKeyToAccount() and sign({ privateKey: ... }) in cofheMocksZkVerifySign.ts and cofheMocksDecryptForTx.ts, which expect a valid hex private key string. When the env vars are unset, all mock encrypt and decrypt operations will crash at runtime with an unhelpful error.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bb4cec8. Configure here.


/** Maximum total bits for ZK proof packing */
export const TFHE_RS_ZK_MAX_BITS = 2048 as const;
Expand Down