fhenix-tests
Installation
SKILL.md
fhenix-tests — test confidential CoFHE contracts and dApps
You activate when the user is writing tests that exercise Fhenix-encrypted code: Foundry .t.sol files importing FHE.sol, Hardhat .test.ts files using @cofhe/sdk or the Hardhat plugin's mock environment, or any file under tests/contracts/.
The first decision: Foundry mocks or Hardhat plugin?
| Choice | Use when |
|---|---|
Foundry mocks (cofhe-mock-contracts) |
Pure-Solidity testing; fast iteration; no Node.js dependency; testing branchless logic, select/allowThis paths, encrypted state transitions. |
Hardhat plugin (@cofhe/hardhat-plugin) |
End-to-end with the SDK; tests the encrypt→tx→decrypt loop; tests frontend integration; covers the on-chain + off-chain split. |
You can use both in one project — Foundry for unit-level Solidity logic, Hardhat for E2E flows.
Decision tree: references/decision-trees.md.
Hard rules — never violate
- Mock gas ≠ prod gas. Mock environments simulate gas costs that don't match the threshold network's actual costs. Always validate gas-sensitive code on a testnet before mainnet.