Hats-Protocol / hats-zodiac

Hats Protocol-enabled Zodiac contracts
MIT License
20 stars 9 forks source link

invariant tests #68

Open spengrah opened 1 month ago

spengrah commented 1 month ago

Running list of HSG invariants:


Notes:

spengrah commented 1 month ago

Useful foundry tool for verifying that no state has been changed for a given contract

function testNoStorageChanges() public {
    // Start recording storage accesses
    vm.record();

    // Perform the operation you're testing
    contract.someFunction();

    // Get the storage accesses
    (bytes32[] memory reads, bytes32[] memory writes) = vm.accesses(address(contract));

    // Assert that no storage writes occurred
    assertEq(writes.length, 0, "Storage was modified unexpectedly");
}