What the mocks deploy
The plugin writes the fixed-address contracts’ bytecode directly with
hardhat_setCode. It deploys MockACL and the two ACP contracts as normal transactions, because they need their constructors to run.
The SDK detects the mocks by checking for code at the MockZkVerifier address. When it finds them, it skips ZK proof generation and lets the mocks verify inputs.
Call a mock directly
cofhe.mocks exposes four of the mocks as viem { address, abi } descriptors. Spread one into readContract or writeContract:
The ABIs are typed, so viem checks
functionName and args at compile time.
Read plaintext values
BecauseMockTaskManager stores plaintexts, you can assert on encrypted state without an ACP or a decryption request. Both helpers accept the handle as a hex string, which is what viem returns for an euint32 getter, or as a bigint.
getPlaintext(ctHash)
Returns the stored plaintext as a bigint:
getPlaintext returns 0n for a handle that has no stored value, so a typo in the handle reads as zero.
expectPlaintext(ctHash, expectedValue)
Throws when the stored plaintext differs from expectedValue, or when the handle has no stored value:
Error whose message names both values:
Redeploy the mocks
cofhe.mocks.deployMocks(options?) runs the deployment again on the current chain:
These defaults apply to the call itself.
deployMocks does not read the cofhe block of your Hardhat config, so a bare call prints the gas warning even when the config turns it off.