Skip to content

[BUG] TESTING.md documents stale API — CoFheTest helper functions and import path are outdated #2

Description

@pplmaverick

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions