Skip to main content
This page summarizes the public surface of @cofhe/foundry-plugin. For task-oriented walkthroughs, see Getting Started and Testing.

CofheTest

Abstract test base. Inherit it instead of forge-std/Test (it inherits Test for you).

Setup

Plaintext reads

Reverts if the handle isn’t in mock storage.

Logging

Public state

CofheClient

Per-user shim. One client per scenario address.

Connection

Encrypt inputs

All produce signed EncryptedInput shapes signed for account().

Decrypt

Permits

Mock storage layout

MockTaskManager.mockStorage is the onchain plaintext storage that backs getPlaintext / expectPlaintext. It only exists in the mock environment. getPlaintext reverts on real CoFHE networks.

foundry.toml requirements

evm_version = "cancun" is no longer required as of @cofhe/mock-contracts@0.7.1. MockACL was migrated off transient storage to block-number-based storage. Set it only if your own contracts need cancun-specific opcodes.

remappings.txt (canonical shape)

  • @cofhe/mock-contracts/ points at the package root, not …/contracts/. The plugin’s imports include the contracts/ segment themselves.
  • hardhat/=node_modules/forge-std/src/ is required so that MockCoFHE.sol’s import "hardhat/console.sol" resolves to forge-std’s compatible console.

Version pinning

@cofhe/foundry-plugin and @cofhe/mock-contracts pin @fhenixprotocol/cofhe-contracts exactly, keep all three CoFHE packages aligned. Known-good tuple as of the latest release: See the Compatibility page for the canonical table.