Summary
TESTING.md and README.md reference a deprecated testing API that no longer matches the current @cofhe/foundry-plugin package. Developers following these docs will encounter missing functions and incorrect import paths.
Root Cause
The docs describe the old direct-inheritance pattern (CoFheTest from @cofhe/mock-contracts), but the repo has since migrated to a CofheClient wrapper pattern (CofheTest from @cofhe/foundry-plugin).
README.md (incorrect):
Tests use CoFheTest from @cofhe/mock-contracts
Actual import (from test/Counter.t.sol):
import {CofheTest} from "@cofhe/foundry-plugin/contracts/CofheTest.sol";
import {CofheClient} from "@cofhe/foundry-plugin/contracts/CofheClient.sol";
Stale vs Actual API
| TESTING.md documents |
Actual API |
Notes |
CoFheTest from @cofhe/mock-contracts |
CofheTest from @cofhe/foundry-plugin |
Wrong package and casing |
assertHashValue(handle, value) |
expectPlaintext(handle, value) |
Renamed |
createInEuint32(value, sender) |
client.createInEuint32(value) |
Now on CofheClient, no sender param |
mockStorage(ctHash) / inMockStorage(ctHash) |
getPlaintext(ctHash) |
Merged into one function |
createPermissionSelf(address) |
client.permit_createSelf() |
Renamed, no address param |
createPermissionShared(a, b) |
client.permit_createShared(recipient) |
Renamed |
signPermissionSelf/Shared/Recipient(...) |
Built into permit_create*() / permit_importShared() |
Functions removed |
decryptForTxWithoutPermit(ctHash) → (bool, string, uint256) |
client.decryptForTx_withoutPermit(ctHash) → (bytes32, uint256, bytes) |
Different name and return type |
setLog(bool) |
enableLogs() / disableLogs() |
Split into two no-arg functions |
Verified Against
@cofhe/foundry-plugin@0.5.1 source in FhenixProtocol/cofhesdk monorepo (packages/foundry-plugin/).
Suggested Fix
Update TESTING.md "CoFheTest Helper Functions" and "Common Test Patterns" sections to reflect the current CofheClient-based API. The README.md import reference also needs correction.
Happy to submit a PR if the maintainers can confirm the intended scope of the update.
Summary
TESTING.mdandREADME.mdreference a deprecated testing API that no longer matches the current@cofhe/foundry-pluginpackage. Developers following these docs will encounter missing functions and incorrect import paths.Root Cause
The docs describe the old direct-inheritance pattern (
CoFheTestfrom@cofhe/mock-contracts), but the repo has since migrated to aCofheClientwrapper pattern (CofheTestfrom@cofhe/foundry-plugin).README.md (incorrect):
Tests use CoFheTest from @cofhe/mock-contracts
Actual import (from
test/Counter.t.sol):Stale vs Actual API
CoFheTestfrom@cofhe/mock-contractsCofheTestfrom@cofhe/foundry-pluginassertHashValue(handle, value)expectPlaintext(handle, value)createInEuint32(value, sender)client.createInEuint32(value)CofheClient, nosenderparammockStorage(ctHash)/inMockStorage(ctHash)getPlaintext(ctHash)createPermissionSelf(address)client.permit_createSelf()createPermissionShared(a, b)client.permit_createShared(recipient)signPermissionSelf/Shared/Recipient(...)permit_create*()/permit_importShared()decryptForTxWithoutPermit(ctHash)→(bool, string, uint256)client.decryptForTx_withoutPermit(ctHash)→(bytes32, uint256, bytes)setLog(bool)enableLogs()/disableLogs()Verified Against
@cofhe/foundry-plugin@0.5.1source inFhenixProtocol/cofhesdkmonorepo (packages/foundry-plugin/).Suggested Fix
Update
TESTING.md"CoFheTest Helper Functions" and "Common Test Patterns" sections to reflect the currentCofheClient-based API. TheREADME.mdimport reference also needs correction.Happy to submit a PR if the maintainers can confirm the intended scope of the update.