Inco’s infrastructure is monitoring the operations requested over encrypted variables by the smart contracts.
Inco executes them asynchronously after the blocks containing the ops are mined. Under the hood, the Inco singleton instance on each
supported chain is emitting events to request the operations (that includes encrypts, trivial encrypts, all logical and mathematical operations,
and decryption requests). The solidity-based mock is using Foundry’s vm.recordLogs() function to record the pending ops.
As the events recording are consumed whenever read, there would be conflicts if you try to use recordLogs in your tests.
To simulate Inco processing the operations, which assigns to its internal value store its encrypted value to each handle, use the following cheatcode:
Copy
Ask AI
processAllOperations();
This cheatcode must be called before reading the value of any encrypted variable, and performing assert statements.
processAllOperations also executes any pending decryption callback.
getBoolValue(ebool input) (bool);// example usageassertEq(getBoolValue(someContract.isActive()), true);
To fully test how one of your user could see its encrypted data, we recommend combining an assertion over the decrypted value with an access control check.
Copy
Ask AI
// example, we check that alice can read her balanceassertTrue(token.balanceOf(alice).isAllowed(alice));