What the mocks simulate
| Contract | Role |
|---|---|
MockTaskManager | Manages FHE operations; stores plaintext values on-chain for testing |
MockACL | Access control for encrypted handles |
MockZkVerifier | Simulates ZK proof verification for encrypted inputs |
MockThresholdNetwork | Handles decryption requests |
TestBed | Helper contract for testing — exposes trivial value setters and a numberHash getter |
MockZkVerifier fixed address) and adapts its behavior accordingly — ZK proof generation is skipped and verification is handled by the mock contracts.
Auto-deployment
Mock contracts are deployed automatically before everynpx hardhat test and npx hardhat node run.
To skip auto-deployment:
You only need
COFHE_SKIP_MOCKS_DEPLOY=1 if your tests exclusively target an external RPC and don’t use the in-process Hardhat network at all.Accessing mock contracts
hre.cofhe.mocks exposes typed accessors for each mock contract:
Reading plaintext values
BecauseMockTaskManager stores plaintext values on-chain, you can read the underlying plaintext of any encrypted handle directly in tests — no permit needed.
getPlaintext(ctHash)
Returns the plaintext bigint for a given ciphertext hash:
expectPlaintext(ctHash, expectedValue)
Assertion shorthand — wraps getPlaintext with a Chai expect: