fhenix-testing-and-mocks
Installation
SKILL.md
Fhenix Testing and Mocks
Overview
CoFHE mocks (@cofhe/mock-contracts) simulate the full coprocessor on a local chain so tests run instantly — no off-chain FHE engine, no real ZK proving. MockTaskManager stores plaintext on-chain, so tests can assert values directly with no permit. The same test code runs unchanged against real CoFHE on testnet. Use with fhenix-hardhat-plugin or fhenix-foundry-plugin.
Core loop: encrypt → store → decrypt (Hardhat)
import hre from 'hardhat';
import { Encryptable, FheTypes } from '@cofhe/sdk';
import { expect } from 'chai';
let cofheClient;
before(async () => {
const [signer] = await hre.ethers.getSigners();
cofheClient = await hre.cofhe.createClientWithBatteries(signer); // connects + pre-creates a self-permit
});