From e063a022505bb9ae043331f58a9feb27bd5c8f11 Mon Sep 17 00:00:00 2001 From: Obsidian <131651958+0xObsidian@users.noreply.github.com> Date: Fri, 27 Dec 2024 05:45:54 -0500 Subject: [PATCH 1/3] fix: added contract validation to setStorageRegistry The setStorageRegistry function was missing validation checks for the new address, which could lead to setting invalid contracts or non-contract addresses as the storage registry. Description ---------- - Added zero address check using revert - Added contract existence check - Used revert with custom errors instead of require() for: - Gas efficiency (4-byte selector vs string storage) - Better ABI compatibility via custom errors - Updated registry tests to align with the current implementation - Fixed `assumeNotPrecompile` issue - Ran forge formatting on all modified files in this PR scope Testing the fix ---------------- Fetch this PR branch and from the root: Add `foundry-rs/forge-std` ``` forge install foundry-rs/forge-std ``` Run test ``` forge test --match-test testFuzzSetStorageRegistry -vvv ``` --- lib/forge-std | 2 +- src/IdGateway.sol | 17 +++++++++--- test/IdGateway/IdGateway.t.sol | 18 +++++++++---- test/IdGateway/IdGatewayTestSuite.sol | 12 ++++----- test/IdRegistry/IdRegistryTestSuite.sol | 12 +++++---- test/KeyRegistry/KeyRegistryTestSuite.sol | 2 +- test/TestSuiteSetup.sol | 32 ++++++++++++++--------- 7 files changed, 60 insertions(+), 35 deletions(-) diff --git a/lib/forge-std b/lib/forge-std index 73d44ec7..b93cf4bc 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 73d44ec7d124e3831bc5f832267889ffb6f9bc3f +Subproject commit b93cf4bc34ff214c099dc970b153f85ade8c9f66 diff --git a/src/IdGateway.sol b/src/IdGateway.sol index b2d44daa..e21ee149 100644 --- a/src/IdGateway.sol +++ b/src/IdGateway.sol @@ -9,6 +9,7 @@ import {TransferHelper} from "./libraries/TransferHelper.sol"; import {EIP712} from "./abstract/EIP712.sol"; import {Nonces} from "./abstract/Nonces.sol"; import {Signatures} from "./abstract/Signatures.sol"; +import {Address} from "openzeppelin/contracts/utils/Address.sol"; /** * @title Farcaster IdGateway @@ -19,6 +20,7 @@ import {Signatures} from "./abstract/Signatures.sol"; */ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces { using TransferHelper for address; + using Address for address; /*////////////////////////////////////////////////////////////// CONSTANTS @@ -90,7 +92,9 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces { /** * @inheritdoc IIdGateway */ - function price(uint256 extraStorage) external view returns (uint256) { + function price( + uint256 extraStorage + ) external view returns (uint256) { return storageRegistry.price(1 + extraStorage); } @@ -101,7 +105,9 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces { /** * @inheritdoc IIdGateway */ - function register(address recovery) external payable returns (uint256, uint256) { + function register( + address recovery + ) external payable returns (uint256, uint256) { return register(recovery, 0); } @@ -145,7 +151,12 @@ contract IdGateway is IIdGateway, Guardians, Signatures, EIP712, Nonces { /** * @inheritdoc IIdGateway */ - function setStorageRegistry(address _storageRegistry) external onlyOwner { + function setStorageRegistry( + address _storageRegistry + ) external onlyOwner { + if (_storageRegistry == address(0)) revert Unauthorized(); + if (!_storageRegistry.isContract()) revert Unauthorized(); + emit SetStorageRegistry(address(storageRegistry), _storageRegistry); storageRegistry = IStorageRegistry(_storageRegistry); } diff --git a/test/IdGateway/IdGateway.t.sol b/test/IdGateway/IdGateway.t.sol index 6d241d7c..6256008d 100644 --- a/test/IdGateway/IdGateway.t.sol +++ b/test/IdGateway/IdGateway.t.sol @@ -23,15 +23,15 @@ contract IdGatewayTest is IdGatewayTestSuite { PARAMETERS //////////////////////////////////////////////////////////////*/ - function testVersion() public { + function testVersion() public view { assertEq(idGateway.VERSION(), "2023.11.15"); } - function testIdRegistry() public { + function testIdRegistry() public view { assertEq(address(idGateway.idRegistry()), address(idRegistry)); } - function testStorageRegistry() public { + function testStorageRegistry() public view { assertEq(address(idGateway.storageRegistry()), address(storageRegistry)); } @@ -365,7 +365,7 @@ contract IdGatewayTest is IdGatewayTestSuite { assertEq(idRegistry.recoveryOf(1), address(0)); } - function testRegisterTypehash() public { + function testRegisterTypehash() public view { assertEq( idGateway.REGISTER_TYPEHASH(), keccak256("Register(address to,address recovery,uint256 nonce,uint256 deadline)") @@ -457,7 +457,15 @@ contract IdGatewayTest is IdGatewayTestSuite { SET STORAGE REGISTRY //////////////////////////////////////////////////////////////*/ - function testFuzzSetStorageRegistry(address storageRegistry) public { + function testFuzzSetStorageRegistry( + address storageRegistry + ) public { + vm.assume(storageRegistry != address(0)); + vm.assume(uint160(storageRegistry) > 9); + + // Mocks that the address is a contract + vm.etch(storageRegistry, hex"00"); + address prevStorageRegistry = address(idGateway.storageRegistry()); vm.expectEmit(); diff --git a/test/IdGateway/IdGatewayTestSuite.sol b/test/IdGateway/IdGatewayTestSuite.sol index f111b2db..abbec895 100644 --- a/test/IdGateway/IdGatewayTestSuite.sol +++ b/test/IdGateway/IdGatewayTestSuite.sol @@ -16,11 +16,7 @@ abstract contract IdGatewayTestSuite is StorageRegistryTestSuite, KeyRegistryTes function setUp() public virtual override(StorageRegistryTestSuite, KeyRegistryTestSuite) { super.setUp(); - idGateway = new IdGateway( - address(idRegistry), - address(storageRegistry), - owner - ); + idGateway = new IdGateway(address(idRegistry), address(storageRegistry), owner); vm.startPrank(owner); idRegistry.setIdGateway(address(idGateway)); @@ -29,7 +25,9 @@ abstract contract IdGatewayTestSuite is StorageRegistryTestSuite, KeyRegistryTes addKnownContract(address(idGateway)); } - function _registerTo(address caller) internal returns (uint256 fid) { + function _registerTo( + address caller + ) internal returns (uint256 fid) { fid = _registerWithRecovery(caller, address(0)); } @@ -58,7 +56,7 @@ abstract contract IdGatewayTestSuite is StorageRegistryTestSuite, KeyRegistryTes address to, address recovery, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idGateway.hashTypedDataV4( keccak256(abi.encode(idGateway.REGISTER_TYPEHASH(), to, recovery, idGateway.nonces(signer), deadline)) diff --git a/test/IdRegistry/IdRegistryTestSuite.sol b/test/IdRegistry/IdRegistryTestSuite.sol index 073702d6..edaac4ec 100644 --- a/test/IdRegistry/IdRegistryTestSuite.sol +++ b/test/IdRegistry/IdRegistryTestSuite.sol @@ -24,7 +24,9 @@ abstract contract IdRegistryTestSuite is TestSuiteSetup { TEST HELPERS //////////////////////////////////////////////////////////////*/ - function _register(address caller) internal returns (uint256 fid) { + function _register( + address caller + ) internal returns (uint256 fid) { fid = _registerWithRecovery(caller, address(0)); } @@ -44,7 +46,7 @@ abstract contract IdRegistryTestSuite is TestSuiteSetup { uint256 fid, address to, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idRegistry.hashTypedDataV4( keccak256(abi.encode(idRegistry.TRANSFER_TYPEHASH(), fid, to, idRegistry.nonces(signer), deadline)) @@ -60,7 +62,7 @@ abstract contract IdRegistryTestSuite is TestSuiteSetup { address to, address recovery, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idRegistry.hashTypedDataV4( keccak256( @@ -85,7 +87,7 @@ abstract contract IdRegistryTestSuite is TestSuiteSetup { address from, address to, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idRegistry.hashTypedDataV4( keccak256( @@ -99,7 +101,7 @@ abstract contract IdRegistryTestSuite is TestSuiteSetup { assertEq(signature.length, 65); } - function _signDigest(uint256 pk, bytes32 digest) internal returns (bytes memory signature) { + function _signDigest(uint256 pk, bytes32 digest) internal pure returns (bytes memory signature) { (uint8 v, bytes32 r, bytes32 s) = vm.sign(pk, digest); signature = abi.encodePacked(r, s, v); assertEq(signature.length, 65); diff --git a/test/KeyRegistry/KeyRegistryTestSuite.sol b/test/KeyRegistry/KeyRegistryTestSuite.sol index e12fe920..2d54681d 100644 --- a/test/KeyRegistry/KeyRegistryTestSuite.sol +++ b/test/KeyRegistry/KeyRegistryTestSuite.sol @@ -32,7 +32,7 @@ abstract contract KeyRegistryTestSuite is IdRegistryTestSuite { address owner, bytes memory key, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = keyRegistry.hashTypedDataV4( keccak256( abi.encode(keyRegistry.REMOVE_TYPEHASH(), owner, keccak256(key), keyRegistry.nonces(owner), deadline) diff --git a/test/TestSuiteSetup.sol b/test/TestSuiteSetup.sol index 5559d4b7..e83d0acb 100644 --- a/test/TestSuiteSetup.sol +++ b/test/TestSuiteSetup.sol @@ -49,38 +49,44 @@ abstract contract TestSuiteSetup is Test { HELPERS //////////////////////////////////////////////////////////////*/ - function addKnownContract(address contractAddress) public { + function addKnownContract( + address contractAddress + ) public { isKnownContract[contractAddress] = true; } // Ensures that a fuzzed address input does not match a known contract address - function _assumeClean(address a) internal { - assumeNoPrecompiles(a); + function _assumeClean( + address a + ) internal view { + assumeNotPrecompile(a); vm.assume(!isKnownContract[a]); vm.assume(a != ADMIN); vm.assume(a != address(0)); } - function _boundPk(uint256 pk) internal view returns (uint256) { + function _boundPk( + uint256 pk + ) internal pure returns (uint256) { return bound(pk, 1, SECP_256K1_ORDER - 1); } - function _boundDeadline(uint40 deadline) internal view returns (uint256) { + function _boundDeadline( + uint40 deadline + ) internal view returns (uint256) { return block.timestamp + uint256(bound(deadline, 0, type(uint40).max)); } - function _createMockERC1271(address ownerAddress) - internal - returns (ERC1271WalletMock mockWallet, address mockWalletAddress) - { + function _createMockERC1271( + address ownerAddress + ) internal returns (ERC1271WalletMock mockWallet, address mockWalletAddress) { mockWallet = new ERC1271WalletMock(ownerAddress); mockWalletAddress = address(mockWallet); } - function _createMaliciousMockERC1271(address ownerAddress) - internal - returns (ERC1271MaliciousMockForceRevert mockWallet, address mockWalletAddress) - { + function _createMaliciousMockERC1271( + address ownerAddress + ) internal returns (ERC1271MaliciousMockForceRevert mockWallet, address mockWalletAddress) { mockWallet = new ERC1271MaliciousMockForceRevert(ownerAddress); mockWalletAddress = address(mockWallet); } From 716e4179994a5bc739090af20edb586d7a63e2a6 Mon Sep 17 00:00:00 2001 From: Obsidian <131651958+0xObsidian@users.noreply.github.com> Date: Fri, 27 Dec 2024 08:47:01 -0500 Subject: [PATCH 2/3] fix: mark function visibility and apply formatting Description ----------- - Added pure/view modifiers to functions that don't modify state - Applied forge fmt for consistent code formatting - Fixed compiler warnings related to state mutability Reason ------ - To prevent accidental state modifications - To make code intentions clearer - To enable better compiler optimizations for read-only calls Breaking changes ---------------- - No introduced changes Testing -------- Fetch this commit branch and run ``` forge coverage -vvv ``` --- script/DeployL1.s.sol | 4 +- script/DeployL2.s.sol | 10 +- script/LocalDeploy.s.sol | 13 +- script/UpgradeL2.s.sol | 10 +- script/abstract/ImmutableCreate2Deployer.sol | 12 +- src/Bundler.sol | 4 +- src/FnameResolver.sol | 16 +- src/IdRegistry.sol | 20 ++- src/KeyRegistry.sol | 28 ++- src/RecoveryProxy.sol | 4 +- src/StorageRegistry.sol | 60 +++++-- src/abstract/EIP712.sol | 4 +- src/abstract/Guardians.sol | 12 +- src/abstract/Migration.sol | 4 +- src/interfaces/IBundler.sol | 4 +- src/interfaces/IIdGateway.sol | 12 +- src/interfaces/IIdRegistry.sol | 20 ++- src/interfaces/IKeyRegistry.sol | 24 ++- src/interfaces/IStorageRegistry.sol | 56 ++++-- src/interfaces/IdRegistryLike.sol | 4 +- src/interfaces/abstract/IEIP712.sol | 4 +- src/interfaces/abstract/IGuardians.sol | 8 +- src/interfaces/abstract/IMigration.sol | 4 +- src/libraries/EnumerableKeySet.sol | 8 +- src/validators/SignedKeyRequestValidator.sol | 8 +- test/Bundler/Bundler.gas.t.sol | 4 +- test/Bundler/Bundler.t.sol | 10 +- test/Bundler/BundlerTestSuite.sol | 15 +- test/Deploy/DeployL1.t.sol | 4 +- test/Deploy/DeployL2.t.sol | 6 +- test/Deploy/UpgradeL2.t.sol | 6 +- test/FnameResolver/FnameResolver.t.sol | 28 +-- test/FnameResolver/FnameResolverTestSuite.sol | 4 +- test/IdGateway/IdGateway.owner.t.sol | 12 +- test/IdGateway/IdGateway.t.sol | 2 +- test/IdRegistry/IdRegistry.migration.t.sol | 72 +++++--- test/IdRegistry/IdRegistry.owner.t.sol | 16 +- test/IdRegistry/IdRegistry.symbolic.t.sol | 4 +- test/IdRegistry/IdRegistry.t.sol | 24 ++- test/IdRegistry/IdRegistryTestHelpers.sol | 12 +- test/KeyGateway/KeyGateway.t.sol | 22 ++- test/KeyGateway/KeyGatewayTestSuite.sol | 4 +- .../KeyRegistry/KeyRegistry.integration.t.sol | 6 +- test/KeyRegistry/KeyRegistry.migration.t.sol | 56 ++++-- test/KeyRegistry/KeyRegistry.symbolic.t.sol | 4 +- test/KeyRegistry/KeyRegistry.t.sol | 48 +++-- test/KeyRegistry/KeyRegistryTestHelpers.sol | 8 +- test/RecoveryProxy/RecoveryProxy.t.sol | 8 +- test/StorageRegistry/StorageRegistry.t.sol | 170 ++++++++++++------ test/Utils.sol | 40 +++-- test/abstract/EIP712/EIP712.t.sol | 2 +- .../Guardians/Guardians.symbolic.t.sol | 8 +- .../Migration/Migration.symbolic.t.sol | 4 +- .../SignedKeyRequestValidator.t.sol | 10 +- .../SignedKeyRequestValidatorTestSuite.sol | 10 +- 55 files changed, 668 insertions(+), 304 deletions(-) diff --git a/script/DeployL1.s.sol b/script/DeployL1.s.sol index 369ffadd..2dc3827b 100644 --- a/script/DeployL1.s.sol +++ b/script/DeployL1.s.sol @@ -22,7 +22,9 @@ contract DeployL1 is ImmutableCreate2Deployer { runDeploy(loadDeploymentParams()); } - function runDeploy(DeploymentParams memory params) public returns (Contracts memory) { + function runDeploy( + DeploymentParams memory params + ) public returns (Contracts memory) { return runDeploy(params, true); } diff --git a/script/DeployL2.s.sol b/script/DeployL2.s.sol index fa42def6..a79f4eea 100644 --- a/script/DeployL2.s.sol +++ b/script/DeployL2.s.sol @@ -75,7 +75,9 @@ contract DeployL2 is ImmutableCreate2Deployer { runSetup(runDeploy(loadDeploymentParams())); } - function runDeploy(DeploymentParams memory params) public returns (Contracts memory) { + function runDeploy( + DeploymentParams memory params + ) public returns (Contracts memory) { return runDeploy(params, true); } @@ -175,12 +177,14 @@ contract DeployL2 is ImmutableCreate2Deployer { } } - function runSetup(Contracts memory contracts) public { + function runSetup( + Contracts memory contracts + ) public { DeploymentParams memory params = loadDeploymentParams(); runSetup(contracts, params, true); } - function loadDeploymentParams() internal returns (DeploymentParams memory) { + function loadDeploymentParams() internal view returns (DeploymentParams memory) { return DeploymentParams({ initialIdRegistryOwner: vm.envAddress("ID_REGISTRY_OWNER_ADDRESS"), initialKeyRegistryOwner: vm.envAddress("KEY_REGISTRY_OWNER_ADDRESS"), diff --git a/script/LocalDeploy.s.sol b/script/LocalDeploy.s.sol index 0d2dc1fa..b48b9ef5 100644 --- a/script/LocalDeploy.s.sol +++ b/script/LocalDeploy.s.sol @@ -36,16 +36,11 @@ contract LocalDeploy is Script { vm.startBroadcast(); (AggregatorV3Interface priceFeed, AggregatorV3Interface uptimeFeed) = _getOrDeployPriceFeeds(); - IdRegistry idRegistry = new IdRegistry{salt: ID_REGISTRY_CREATE2_SALT}( - migrator, - initialIdRegistryOwner + IdRegistry idRegistry = new IdRegistry{salt: ID_REGISTRY_CREATE2_SALT}(migrator, initialIdRegistryOwner); + KeyRegistry keyRegistry = new KeyRegistry{salt: KEY_REGISTRY_CREATE2_SALT}( + address(idRegistry), migrator, initialKeyRegistryOwner, 1000 ); - KeyRegistry keyRegistry = new KeyRegistry{ - salt: KEY_REGISTRY_CREATE2_SALT - }(address(idRegistry), migrator, initialKeyRegistryOwner, 1000); - StorageRegistry storageRegistry = new StorageRegistry{ - salt: STORAGE_RENT_CREATE2_SALT - }( + StorageRegistry storageRegistry = new StorageRegistry{salt: STORAGE_RENT_CREATE2_SALT}( priceFeed, uptimeFeed, INITIAL_USD_UNIT_PRICE, diff --git a/script/UpgradeL2.s.sol b/script/UpgradeL2.s.sol index 6a2aa608..45b4b071 100644 --- a/script/UpgradeL2.s.sol +++ b/script/UpgradeL2.s.sol @@ -69,7 +69,9 @@ contract UpgradeL2 is ImmutableCreate2Deployer, Test { runSetup(runDeploy(loadDeploymentParams())); } - function runDeploy(DeploymentParams memory params) public returns (Contracts memory) { + function runDeploy( + DeploymentParams memory params + ) public returns (Contracts memory) { return runDeploy(params, true); } @@ -182,12 +184,14 @@ contract UpgradeL2 is ImmutableCreate2Deployer, Test { } } - function runSetup(Contracts memory contracts) public { + function runSetup( + Contracts memory contracts + ) public { DeploymentParams memory params = loadDeploymentParams(); runSetup(contracts, params, true); } - function loadDeploymentParams() internal returns (DeploymentParams memory) { + function loadDeploymentParams() internal view returns (DeploymentParams memory) { return DeploymentParams({ initialIdRegistryOwner: vm.envAddress("ID_REGISTRY_OWNER_ADDRESS"), initialKeyRegistryOwner: vm.envAddress("KEY_REGISTRY_OWNER_ADDRESS"), diff --git a/script/abstract/ImmutableCreate2Deployer.sol b/script/abstract/ImmutableCreate2Deployer.sol index 49a4a5af..72c19eba 100644 --- a/script/abstract/ImmutableCreate2Deployer.sol +++ b/script/abstract/ImmutableCreate2Deployer.sol @@ -6,7 +6,9 @@ import "forge-std/console.sol"; import {Strings} from "openzeppelin/contracts/utils/Strings.sol"; interface ImmutableCreate2Factory { - function hasBeenDeployed(address deploymentAddress) external view returns (bool); + function hasBeenDeployed( + address deploymentAddress + ) external view returns (bool); function findCreate2Address( bytes32 salt, @@ -132,7 +134,9 @@ abstract contract ImmutableCreate2Deployer is Script { /** * @dev Deploy all registered contracts. */ - function deploy(bool broadcast) internal { + function deploy( + bool broadcast + ) internal { console.log(pad("State", 10), pad("Name", 27), pad("Address", 43), "Initcode hash"); for (uint256 i; i < names.length; i++) { _deploy(names[i], broadcast); @@ -153,7 +157,9 @@ abstract contract ImmutableCreate2Deployer is Script { _deploy(name, broadcast); } - function deploy(string memory name) internal { + function deploy( + string memory name + ) internal { deploy(name, true); } diff --git a/src/Bundler.sol b/src/Bundler.sol index 40d08ea4..bce1e4a3 100644 --- a/src/Bundler.sol +++ b/src/Bundler.sol @@ -57,7 +57,9 @@ contract Bundler is IBundler { /** * @inheritdoc IBundler */ - function price(uint256 extraStorage) external view returns (uint256) { + function price( + uint256 extraStorage + ) external view returns (uint256) { return idGateway.price(extraStorage); } diff --git a/src/FnameResolver.sol b/src/FnameResolver.sol index d9b6b039..82524921 100644 --- a/src/FnameResolver.sol +++ b/src/FnameResolver.sol @@ -8,7 +8,9 @@ import {ERC165} from "openzeppelin/contracts/utils/introspection/ERC165.sol"; import {EIP712} from "./abstract/EIP712.sol"; interface IAddressQuery { - function addr(bytes32 node) external view returns (address); + function addr( + bytes32 node + ) external view returns (address); } interface IExtendedResolver { @@ -183,7 +185,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step { * * @param signer The signer address. */ - function addSigner(address signer) external onlyOwner { + function addSigner( + address signer + ) external onlyOwner { signers[signer] = true; emit AddSigner(signer); } @@ -193,7 +197,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step { * * @param signer The signer address. */ - function removeSigner(address signer) external onlyOwner { + function removeSigner( + address signer + ) external onlyOwner { signers[signer] = false; emit RemoveSigner(signer); } @@ -202,7 +208,9 @@ contract FnameResolver is IExtendedResolver, EIP712, ERC165, Ownable2Step { INTERFACE DETECTION //////////////////////////////////////////////////////////////*/ - function supportsInterface(bytes4 interfaceId) public view override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public view override returns (bool) { return interfaceId == type(IExtendedResolver).interfaceId || super.supportsInterface(interfaceId); } } diff --git a/src/IdRegistry.sol b/src/IdRegistry.sol index 259441ff..b3249167 100644 --- a/src/IdRegistry.sol +++ b/src/IdRegistry.sol @@ -255,7 +255,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IIdRegistry */ - function changeRecoveryAddress(address recovery) external whenNotPaused { + function changeRecoveryAddress( + address recovery + ) external whenNotPaused { /* Revert if the caller does not own an fid */ uint256 ownerId = idOf[msg.sender]; if (ownerId == 0) revert HasNoId(); @@ -359,7 +361,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IIdRegistry */ - function setIdGateway(address _idGateway) external onlyOwner { + function setIdGateway( + address _idGateway + ) external onlyOwner { if (gatewayFrozen) revert GatewayFrozen(); emit SetIdGateway(idGateway, _idGateway); idGateway = _idGateway; @@ -378,7 +382,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces { MIGRATION //////////////////////////////////////////////////////////////*/ - function bulkRegisterIds(BulkRegisterData[] calldata ids) external onlyMigrator { + function bulkRegisterIds( + BulkRegisterData[] calldata ids + ) external onlyMigrator { // Safety: i can be incremented unchecked since it is bound by ids.length. unchecked { for (uint256 i = 0; i < ids.length; i++) { @@ -403,7 +409,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces { } } - function bulkResetIds(uint24[] calldata ids) external onlyMigrator { + function bulkResetIds( + uint24[] calldata ids + ) external onlyMigrator { // Safety: i can be incremented unchecked since it is bound by ids.length. unchecked { for (uint256 i = 0; i < ids.length; i++) { @@ -419,7 +427,9 @@ contract IdRegistry is IIdRegistry, Migration, Signatures, EIP712, Nonces { } } - function setIdCounter(uint256 _counter) external onlyMigrator { + function setIdCounter( + uint256 _counter + ) external onlyMigrator { emit SetIdCounter(idCounter, _counter); idCounter = _counter; } diff --git a/src/KeyRegistry.sol b/src/KeyRegistry.sol index 4b0f7ddc..ab88cffc 100644 --- a/src/KeyRegistry.sol +++ b/src/KeyRegistry.sol @@ -194,7 +194,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function remove(bytes calldata key) external whenNotPaused { + function remove( + bytes calldata key + ) external whenNotPaused { _remove(_fidOf(msg.sender), key); } @@ -218,7 +220,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function bulkAddKeysForMigration(BulkAddData[] calldata items) external onlyMigrator { + function bulkAddKeysForMigration( + BulkAddData[] calldata items + ) external onlyMigrator { // Safety: i and j can be incremented unchecked since they are bound by items.length and // items[i].keys.length respectively. unchecked { @@ -234,7 +238,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function bulkResetKeysForMigration(BulkResetData[] calldata items) external onlyMigrator { + function bulkResetKeysForMigration( + BulkResetData[] calldata items + ) external onlyMigrator { // Safety: i and j can be incremented unchecked since they are bound by items.length and // items[i].keys.length respectively. unchecked { @@ -264,7 +270,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function setIdRegistry(address _idRegistry) external onlyOwner { + function setIdRegistry( + address _idRegistry + ) external onlyOwner { emit SetIdRegistry(address(idRegistry), _idRegistry); idRegistry = IdRegistryLike(_idRegistry); } @@ -272,7 +280,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function setKeyGateway(address _keyGateway) external onlyOwner { + function setKeyGateway( + address _keyGateway + ) external onlyOwner { if (gatewayFrozen) revert GatewayFrozen(); emit SetKeyGateway(keyGateway, _keyGateway); keyGateway = _keyGateway; @@ -290,7 +300,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { /** * @inheritdoc IKeyRegistry */ - function setMaxKeysPerFid(uint256 _maxKeysPerFid) external onlyOwner { + function setMaxKeysPerFid( + uint256 _maxKeysPerFid + ) external onlyOwner { if (_maxKeysPerFid <= maxKeysPerFid) revert InvalidMaxKeys(); emit SetMaxKeysPerFid(maxKeysPerFid, _maxKeysPerFid); maxKeysPerFid = _maxKeysPerFid; @@ -376,7 +388,9 @@ contract KeyRegistry is IKeyRegistry, Migration, Signatures, EIP712, Nonces { FID HELPERS //////////////////////////////////////////////////////////////*/ - function _fidOf(address fidOwner) internal view returns (uint256 fid) { + function _fidOf( + address fidOwner + ) internal view returns (uint256 fid) { fid = idRegistry.idOf(fidOwner); if (fid == 0) revert Unauthorized(); } diff --git a/src/RecoveryProxy.sol b/src/RecoveryProxy.sol index 6f966aa4..ef47f68e 100644 --- a/src/RecoveryProxy.sol +++ b/src/RecoveryProxy.sol @@ -76,7 +76,9 @@ contract RecoveryProxy is Ownable2Step { * * @param _idRegistry IDRegistry contract address. */ - function setIdRegistry(IIdRegistry _idRegistry) external onlyOwner { + function setIdRegistry( + IIdRegistry _idRegistry + ) external onlyOwner { emit SetIdRegistry(idRegistry, _idRegistry); idRegistry = _idRegistry; } diff --git a/src/StorageRegistry.sol b/src/StorageRegistry.sol index b6e46048..790634be 100644 --- a/src/StorageRegistry.sol +++ b/src/StorageRegistry.sol @@ -501,7 +501,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function price(uint256 units) public view returns (uint256) { + function price( + uint256 units + ) public view returns (uint256) { uint256 ethPrice; if (fixedEthUsdPrice != 0) { ethPrice = fixedEthUsdPrice; @@ -618,7 +620,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @dev Calculate the cost in wei to rent storage units. */ - function _price(uint256 units) internal returns (uint256) { + function _price( + uint256 units + ) internal returns (uint256) { return _price(units, usdUnitPrice, _ethUsdPrice()); } @@ -697,7 +701,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setPriceFeed(AggregatorV3Interface feed) external onlyOwner { + function setPriceFeed( + AggregatorV3Interface feed + ) external onlyOwner { emit SetPriceFeed(address(priceFeed), address(feed)); priceFeed = feed; } @@ -705,7 +711,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setUptimeFeed(AggregatorV3Interface feed) external onlyOwner { + function setUptimeFeed( + AggregatorV3Interface feed + ) external onlyOwner { emit SetUptimeFeed(address(uptimeFeed), address(feed)); uptimeFeed = feed; } @@ -713,7 +721,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setPrice(uint256 usdPrice) external onlyOwner { + function setPrice( + uint256 usdPrice + ) external onlyOwner { emit SetPrice(usdUnitPrice, usdPrice); usdUnitPrice = usdPrice; } @@ -721,7 +731,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setFixedEthUsdPrice(uint256 fixedPrice) external onlyOwner { + function setFixedEthUsdPrice( + uint256 fixedPrice + ) external onlyOwner { if (fixedPrice != 0) { if (fixedPrice < priceFeedMinAnswer || fixedPrice > priceFeedMaxAnswer) revert InvalidFixedPrice(); } @@ -732,7 +744,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setMaxUnits(uint256 max) external onlyOwner { + function setMaxUnits( + uint256 max + ) external onlyOwner { emit SetMaxUnits(maxUnits, max); maxUnits = max; } @@ -740,7 +754,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setDeprecationTimestamp(uint256 timestamp) external onlyOwner { + function setDeprecationTimestamp( + uint256 timestamp + ) external onlyOwner { if (timestamp < block.timestamp) revert InvalidDeprecationTimestamp(); emit SetDeprecationTimestamp(deprecationTimestamp, timestamp); deprecationTimestamp = timestamp; @@ -749,7 +765,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setCacheDuration(uint256 duration) external onlyOwner { + function setCacheDuration( + uint256 duration + ) external onlyOwner { emit SetCacheDuration(priceFeedCacheDuration, duration); priceFeedCacheDuration = duration; } @@ -757,7 +775,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setMaxAge(uint256 age) external onlyOwner { + function setMaxAge( + uint256 age + ) external onlyOwner { emit SetMaxAge(priceFeedMaxAge, age); priceFeedMaxAge = age; } @@ -765,7 +785,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setMinAnswer(uint256 minPrice) external onlyOwner { + function setMinAnswer( + uint256 minPrice + ) external onlyOwner { if (minPrice >= priceFeedMaxAnswer) revert InvalidMinAnswer(); emit SetMinAnswer(priceFeedMinAnswer, minPrice); priceFeedMinAnswer = minPrice; @@ -774,7 +796,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setMaxAnswer(uint256 maxPrice) external onlyOwner { + function setMaxAnswer( + uint256 maxPrice + ) external onlyOwner { if (maxPrice <= priceFeedMinAnswer) revert InvalidMaxAnswer(); emit SetMaxAnswer(priceFeedMaxAnswer, maxPrice); priceFeedMaxAnswer = maxPrice; @@ -783,7 +807,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setGracePeriod(uint256 period) external onlyOwner { + function setGracePeriod( + uint256 period + ) external onlyOwner { emit SetGracePeriod(uptimeFeedGracePeriod, period); uptimeFeedGracePeriod = period; } @@ -791,7 +817,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function setVault(address vaultAddr) external onlyOwner { + function setVault( + address vaultAddr + ) external onlyOwner { if (vaultAddr == address(0)) revert InvalidAddress(); emit SetVault(vault, vaultAddr); vault = vaultAddr; @@ -800,7 +828,9 @@ contract StorageRegistry is IStorageRegistry, AccessControlEnumerable, Pausable /** * @inheritdoc IStorageRegistry */ - function withdraw(uint256 amount) external onlyTreasurer { + function withdraw( + uint256 amount + ) external onlyTreasurer { emit Withdraw(vault, amount); vault.sendNative(amount); } diff --git a/src/abstract/EIP712.sol b/src/abstract/EIP712.sol index 1255ccba..dc17a7c6 100644 --- a/src/abstract/EIP712.sol +++ b/src/abstract/EIP712.sol @@ -22,7 +22,9 @@ abstract contract EIP712 is IEIP712, EIP712Base { /** * @inheritdoc IEIP712 */ - function hashTypedDataV4(bytes32 structHash) external view returns (bytes32) { + function hashTypedDataV4( + bytes32 structHash + ) external view returns (bytes32) { return _hashTypedDataV4(structHash); } } diff --git a/src/abstract/Guardians.sol b/src/abstract/Guardians.sol index ce6cdf90..25a712f9 100644 --- a/src/abstract/Guardians.sol +++ b/src/abstract/Guardians.sol @@ -36,7 +36,9 @@ abstract contract Guardians is IGuardians, Ownable2Step, Pausable { * * @param _initialOwner Address of the contract owner. */ - constructor(address _initialOwner) { + constructor( + address _initialOwner + ) { _transferOwnership(_initialOwner); } @@ -47,7 +49,9 @@ abstract contract Guardians is IGuardians, Ownable2Step, Pausable { /** * @inheritdoc IGuardians */ - function addGuardian(address guardian) external onlyOwner { + function addGuardian( + address guardian + ) external onlyOwner { guardians[guardian] = true; emit Add(guardian); } @@ -55,7 +59,9 @@ abstract contract Guardians is IGuardians, Ownable2Step, Pausable { /** * @inheritdoc IGuardians */ - function removeGuardian(address guardian) external onlyOwner { + function removeGuardian( + address guardian + ) external onlyOwner { guardians[guardian] = false; emit Remove(guardian); } diff --git a/src/abstract/Migration.sol b/src/abstract/Migration.sol index 86361af6..63a5cdec 100644 --- a/src/abstract/Migration.sol +++ b/src/abstract/Migration.sol @@ -96,7 +96,9 @@ abstract contract Migration is IMigration, Guardians { /** * @inheritdoc IMigration */ - function setMigrator(address _migrator) public onlyOwner { + function setMigrator( + address _migrator + ) public onlyOwner { if (isMigrated()) revert AlreadyMigrated(); _requirePaused(); emit SetMigrator(migrator, _migrator); diff --git a/src/interfaces/IBundler.sol b/src/interfaces/IBundler.sol index be4125a4..e09a00ad 100644 --- a/src/interfaces/IBundler.sol +++ b/src/interfaces/IBundler.sol @@ -67,7 +67,9 @@ interface IBundler { * @return Total price in wei. * */ - function price(uint256 extraStorage) external view returns (uint256); + function price( + uint256 extraStorage + ) external view returns (uint256); /*////////////////////////////////////////////////////////////// REGISTRATION diff --git a/src/interfaces/IIdGateway.sol b/src/interfaces/IIdGateway.sol index 637c9b9c..938996d8 100644 --- a/src/interfaces/IIdGateway.sol +++ b/src/interfaces/IIdGateway.sol @@ -70,7 +70,9 @@ interface IIdGateway { * * @return Total price in wei. */ - function price(uint256 extraStorage) external view returns (uint256); + function price( + uint256 extraStorage + ) external view returns (uint256); /*////////////////////////////////////////////////////////////// REGISTRATION LOGIC @@ -83,7 +85,9 @@ interface IIdGateway { * * @return fid registered FID. */ - function register(address recovery) external payable returns (uint256 fid, uint256 overpayment); + function register( + address recovery + ) external payable returns (uint256 fid, uint256 overpayment); /** * @notice Register a new Farcaster ID (fid) to the caller and rent additional storage. @@ -148,5 +152,7 @@ interface IIdGateway { * * @param _storageRegistry The new StorageREgistry address. */ - function setStorageRegistry(address _storageRegistry) external; + function setStorageRegistry( + address _storageRegistry + ) external; } diff --git a/src/interfaces/IIdRegistry.sol b/src/interfaces/IIdRegistry.sol index 25d2220e..23afafe2 100644 --- a/src/interfaces/IIdRegistry.sol +++ b/src/interfaces/IIdRegistry.sol @@ -187,17 +187,23 @@ interface IIdRegistry { /** * @notice Maps each address to an fid, or zero if it does not own an fid. */ - function idOf(address owner) external view returns (uint256 fid); + function idOf( + address owner + ) external view returns (uint256 fid); /** * @notice Maps each fid to the address that currently owns it. */ - function custodyOf(uint256 fid) external view returns (address owner); + function custodyOf( + uint256 fid + ) external view returns (address owner); /** * @notice Maps each fid to an address that can initiate a recovery. */ - function recoveryOf(uint256 fid) external view returns (address recovery); + function recoveryOf( + uint256 fid + ) external view returns (address recovery); /*////////////////////////////////////////////////////////////// TRANSFER LOGIC @@ -283,7 +289,9 @@ interface IIdRegistry { * * @param recovery The address which can recover the fid. Set to 0x0 to disable recovery. */ - function changeRecoveryAddress(address recovery) external; + function changeRecoveryAddress( + address recovery + ) external; /** * @notice Change the recovery address of fid owned by the owner. Caller must provide an @@ -364,7 +372,9 @@ interface IIdRegistry { * * @param _idGateway The new IdGateway address. */ - function setIdGateway(address _idGateway) external; + function setIdGateway( + address _idGateway + ) external; /** * @notice Permanently freeze the IdGateway address. Only callable by owner. diff --git a/src/interfaces/IKeyRegistry.sol b/src/interfaces/IKeyRegistry.sol index 42e20b0e..c03a1c90 100644 --- a/src/interfaces/IKeyRegistry.sol +++ b/src/interfaces/IKeyRegistry.sol @@ -335,7 +335,9 @@ interface IKeyRegistry { * * @param key Bytes of the key to remove. */ - function remove(bytes calldata key) external; + function remove( + bytes calldata key + ) external; /** * @notice Remove a key on behalf of another fid owner, setting the key state to REMOVED. @@ -374,7 +376,9 @@ interface IKeyRegistry { * * @param items An array of BulkAddData structs including fid and array of BulkAddKey structs. */ - function bulkAddKeysForMigration(BulkAddData[] calldata items) external; + function bulkAddKeysForMigration( + BulkAddData[] calldata items + ) external; /** * @notice Reset multiple keys as part of the initial migration. Only callable by the contract owner. @@ -384,7 +388,9 @@ interface IKeyRegistry { * * @param items A list of BulkResetData structs including an fid and array of keys. */ - function bulkResetKeysForMigration(BulkResetData[] calldata items) external; + function bulkResetKeysForMigration( + BulkResetData[] calldata items + ) external; /** * @notice Set a metadata validator contract for the given keyType and metadataType. Only callable by owner. @@ -400,14 +406,18 @@ interface IKeyRegistry { * * @param _idRegistry The new IdRegistry address. */ - function setIdRegistry(address _idRegistry) external; + function setIdRegistry( + address _idRegistry + ) external; /** * @notice Set the KeyGateway address allowed to add keys. Only callable by owner. * * @param _keyGateway The new KeyGateway address. */ - function setKeyGateway(address _keyGateway) external; + function setKeyGateway( + address _keyGateway + ) external; /** * @notice Permanently freeze the KeyGateway address. Only callable by owner. @@ -419,5 +429,7 @@ interface IKeyRegistry { * * @param _maxKeysPerFid The new max keys per fid. */ - function setMaxKeysPerFid(uint256 _maxKeysPerFid) external; + function setMaxKeysPerFid( + uint256 _maxKeysPerFid + ) external; } diff --git a/src/interfaces/IStorageRegistry.sol b/src/interfaces/IStorageRegistry.sol index 532fbfc8..1020a927 100644 --- a/src/interfaces/IStorageRegistry.sol +++ b/src/interfaces/IStorageRegistry.sol @@ -153,7 +153,9 @@ interface IStorageRegistry { * @param units Number of storage units. * @return uint256 cost in wei. */ - function price(uint256 units) external view returns (uint256); + function price( + uint256 units + ) external view returns (uint256); /*////////////////////////////////////////////////////////////// PERMISSIONED ACTIONS @@ -194,21 +196,27 @@ interface IStorageRegistry { * * @param feed The new price feed. */ - function setPriceFeed(AggregatorV3Interface feed) external; + function setPriceFeed( + AggregatorV3Interface feed + ) external; /** * @notice Change the uptime feed addresss. Callable by owner. * * @param feed The new uptime feed. */ - function setUptimeFeed(AggregatorV3Interface feed) external; + function setUptimeFeed( + AggregatorV3Interface feed + ) external; /** * @notice Change the USD price per storage unit. Callable by owner. * * @param usdPrice The new unit price in USD. Fixed point value with 8 decimals. */ - function setPrice(uint256 usdPrice) external; + function setPrice( + uint256 usdPrice + ) external; /** * @notice Set the fixed ETH/USD price, disabling the price feed if the value is @@ -219,56 +227,72 @@ interface IStorageRegistry { * Setting this value back to zero from a nonzero value will * re-enable the price feed. */ - function setFixedEthUsdPrice(uint256 fixedPrice) external; + function setFixedEthUsdPrice( + uint256 fixedPrice + ) external; /** * @notice Change the maximum supply of storage units. Only callable by owner. * * @param max The new maximum supply of storage units. */ - function setMaxUnits(uint256 max) external; + function setMaxUnits( + uint256 max + ) external; /** * @notice Change the deprecationTimestamp. Only callable by owner. * * @param timestamp The new deprecationTimestamp. Must be at least equal to block.timestamp. */ - function setDeprecationTimestamp(uint256 timestamp) external; + function setDeprecationTimestamp( + uint256 timestamp + ) external; /** * @notice Change the priceFeedCacheDuration. Only callable by owner. * * @param duration The new priceFeedCacheDuration. */ - function setCacheDuration(uint256 duration) external; + function setCacheDuration( + uint256 duration + ) external; /** * @notice Change the priceFeedMaxAge. Only callable by owner. * * @param age The new priceFeedMaxAge. */ - function setMaxAge(uint256 age) external; + function setMaxAge( + uint256 age + ) external; /** * @notice Change the priceFeedMinAnswer. Only callable by owner. * * @param minPrice The new priceFeedMinAnswer. Must be less than current priceFeedMaxAnswer. */ - function setMinAnswer(uint256 minPrice) external; + function setMinAnswer( + uint256 minPrice + ) external; /** * @notice Change the priceFeedMaxAnswer. Only callable by owner. * * @param maxPrice The new priceFeedMaxAnswer. Must be greater than current priceFeedMinAnswer. */ - function setMaxAnswer(uint256 maxPrice) external; + function setMaxAnswer( + uint256 maxPrice + ) external; /** * @notice Change the uptimeFeedGracePeriod. Only callable by owner. * * @param period The new uptimeFeedGracePeriod. */ - function setGracePeriod(uint256 period) external; + function setGracePeriod( + uint256 period + ) external; /** * @notice Change the vault address that can receive funds from this contract. @@ -276,7 +300,9 @@ interface IStorageRegistry { * * @param vaultAddr The new vault address. */ - function setVault(address vaultAddr) external; + function setVault( + address vaultAddr + ) external; /** * @notice Withdraw a specified amount of ether from the contract balance to the vault. @@ -284,7 +310,9 @@ interface IStorageRegistry { * * @param amount The amount of ether to withdraw. */ - function withdraw(uint256 amount) external; + function withdraw( + uint256 amount + ) external; /** * @notice Pause, disabling rentals and credits. diff --git a/src/interfaces/IdRegistryLike.sol b/src/interfaces/IdRegistryLike.sol index 1dc2740b..6d2900c8 100644 --- a/src/interfaces/IdRegistryLike.sol +++ b/src/interfaces/IdRegistryLike.sol @@ -12,7 +12,9 @@ interface IdRegistryLike { /** * @notice Maps each address to an fid, or zero if it does not own an fid. */ - function idOf(address fidOwner) external view returns (uint256); + function idOf( + address fidOwner + ) external view returns (uint256); /*////////////////////////////////////////////////////////////// VIEWS diff --git a/src/interfaces/abstract/IEIP712.sol b/src/interfaces/abstract/IEIP712.sol index 3e084c08..3c07cbaa 100644 --- a/src/interfaces/abstract/IEIP712.sol +++ b/src/interfaces/abstract/IEIP712.sol @@ -20,5 +20,7 @@ interface IEIP712 { * * @return bytes32 EIP-712 message digest. */ - function hashTypedDataV4(bytes32 structHash) external view returns (bytes32); + function hashTypedDataV4( + bytes32 structHash + ) external view returns (bytes32); } diff --git a/src/interfaces/abstract/IGuardians.sol b/src/interfaces/abstract/IGuardians.sol index 9262b715..1b9d6ee1 100644 --- a/src/interfaces/abstract/IGuardians.sol +++ b/src/interfaces/abstract/IGuardians.sol @@ -36,14 +36,18 @@ interface IGuardians { * * @param guardian Address of the guardian. */ - function addGuardian(address guardian) external; + function addGuardian( + address guardian + ) external; /** * @notice Remove a guardian. Only callable by owner. * * @param guardian Address of the guardian. */ - function removeGuardian(address guardian) external; + function removeGuardian( + address guardian + ) external; /** * @notice Pause the contract. Only callable by owner or a guardian. diff --git a/src/interfaces/abstract/IMigration.sol b/src/interfaces/abstract/IMigration.sol index 7cc45b63..4939b3a4 100644 --- a/src/interfaces/abstract/IMigration.sol +++ b/src/interfaces/abstract/IMigration.sol @@ -88,5 +88,7 @@ interface IMigration { * * @param _migrator Migrator address. */ - function setMigrator(address _migrator) external; + function setMigrator( + address _migrator + ) external; } diff --git a/src/libraries/EnumerableKeySet.sol b/src/libraries/EnumerableKeySet.sol index 6957c39d..a4edfe90 100644 --- a/src/libraries/EnumerableKeySet.sol +++ b/src/libraries/EnumerableKeySet.sol @@ -81,7 +81,9 @@ library EnumerableKeySet { /** * @dev Returns the number of values in the set. O(1). */ - function length(KeySet storage set) internal view returns (uint256) { + function length( + KeySet storage set + ) internal view returns (uint256) { return set._values.length; } @@ -107,7 +109,9 @@ library EnumerableKeySet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function values(KeySet storage set) internal view returns (bytes[] memory) { + function values( + KeySet storage set + ) internal view returns (bytes[] memory) { return set._values; } } diff --git a/src/validators/SignedKeyRequestValidator.sol b/src/validators/SignedKeyRequestValidator.sol index 26052f60..364e9d25 100644 --- a/src/validators/SignedKeyRequestValidator.sol +++ b/src/validators/SignedKeyRequestValidator.sol @@ -132,7 +132,9 @@ contract SignedKeyRequestValidator is IMetadataValidator, Ownable2Step, EIP712 { * * @return bytes memory Bytes of ABI-encoded struct. */ - function encodeMetadata(SignedKeyRequestMetadata calldata metadata) external pure returns (bytes memory) { + function encodeMetadata( + SignedKeyRequestMetadata calldata metadata + ) external pure returns (bytes memory) { return abi.encode(metadata); } @@ -145,7 +147,9 @@ contract SignedKeyRequestValidator is IMetadataValidator, Ownable2Step, EIP712 { * * @param _idRegistry The new IdRegistry address. */ - function setIdRegistry(address _idRegistry) external onlyOwner { + function setIdRegistry( + address _idRegistry + ) external onlyOwner { emit SetIdRegistry(address(idRegistry), _idRegistry); idRegistry = IdRegistryLike(_idRegistry); } diff --git a/test/Bundler/Bundler.gas.t.sol b/test/Bundler/Bundler.gas.t.sol index e9df73a6..27c1a48d 100644 --- a/test/Bundler/Bundler.gas.t.sol +++ b/test/Bundler/Bundler.gas.t.sol @@ -20,9 +20,7 @@ contract BundleRegistryGasUsageTest is BundlerTestSuite { bytes memory sig = _signRegister(i, account, address(0), type(uint40).max); uint256 price = bundler.price(1); - IBundler.SignerParams[] memory signers = new IBundler.SignerParams[]( - 0 - ); + IBundler.SignerParams[] memory signers = new IBundler.SignerParams[](0); vm.deal(account, 10_000 ether); vm.prank(account); diff --git a/test/Bundler/Bundler.t.sol b/test/Bundler/Bundler.t.sol index 9d4bd245..479c9fb9 100644 --- a/test/Bundler/Bundler.t.sol +++ b/test/Bundler/Bundler.t.sol @@ -23,11 +23,11 @@ contract BundlerTest is BundlerTestSuite { PARAMETERS //////////////////////////////////////////////////////////////*/ - function testHasIDRegistry() public { + function testHasIDRegistry() public view { assertEq(address(bundler.idGateway()), address(idGateway)); } - function testVersion() public { + function testVersion() public view { assertEq(bundler.VERSION(), "2023.11.15"); } @@ -41,9 +41,7 @@ contract BundlerTest is BundlerTestSuite { uint256 deadline, uint256 numSigners ) internal returns (IBundler.SignerParams[] memory) { - IBundler.SignerParams[] memory signers = new IBundler.SignerParams[]( - numSigners - ); + IBundler.SignerParams[] memory signers = new IBundler.SignerParams[](numSigners); uint256 nonce = keyRegistry.nonces(account); // The duplication below is ugly but necessary to work around a stack too deep error. @@ -64,7 +62,7 @@ contract BundlerTest is BundlerTestSuite { abi.encodePacked("metadata", keccak256(abi.encode(i))), nonce + i, deadline - ) + ) }); } return signers; diff --git a/test/Bundler/BundlerTestSuite.sol b/test/Bundler/BundlerTestSuite.sol index 28343cc2..e168e784 100644 --- a/test/Bundler/BundlerTestSuite.sol +++ b/test/Bundler/BundlerTestSuite.sol @@ -22,23 +22,22 @@ abstract contract BundlerTestSuite is IdGatewayTestSuite { keyRegistry.setKeyGateway(address(keyGateway)); // Set up the BundleRegistry - bundler = new Bundler( - address(idGateway), - address(keyGateway) - ); + bundler = new Bundler(address(idGateway), address(keyGateway)); addKnownContract(address(keyGateway)); addKnownContract(address(bundler)); } // Assert that a given fname was correctly registered with id 1 and recovery - function _assertSuccessfulRegistration(address account, address recovery) internal { + function _assertSuccessfulRegistration(address account, address recovery) internal view { assertEq(idRegistry.idOf(account), 1); assertEq(idRegistry.recoveryOf(1), recovery); } // Assert that a given fname was not registered and the contracts have no registrations - function _assertUnsuccessfulRegistration(address account) internal { + function _assertUnsuccessfulRegistration( + address account + ) internal view { assertEq(idRegistry.idOf(account), 0); assertEq(idRegistry.recoveryOf(1), address(0)); } @@ -51,7 +50,7 @@ abstract contract BundlerTestSuite is IdGatewayTestSuite { uint8 metadataType, bytes memory metadata, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { return _signAdd(pk, owner, keyType, key, metadataType, metadata, keyGateway.nonces(owner), deadline); } @@ -64,7 +63,7 @@ abstract contract BundlerTestSuite is IdGatewayTestSuite { bytes memory metadata, uint256 nonce, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = keyGateway.hashTypedDataV4( keccak256( abi.encode( diff --git a/test/Deploy/DeployL1.t.sol b/test/Deploy/DeployL1.t.sol index ba118d8c..edc99e54 100644 --- a/test/Deploy/DeployL1.t.sol +++ b/test/Deploy/DeployL1.t.sol @@ -31,14 +31,14 @@ contract DeployL1Test is DeployL1, FnameResolverTestSuite { resolver = contracts.fnameResolver; } - function test_deploymentParams() public { + function test_deploymentParams() public view { // Check deployment parameters assertEq(resolver.url(), "https://fnames.farcaster.xyz/ccip/{sender}/{data}.json"); assertEq(resolver.owner(), alpha); assertEq(resolver.signers(signer), true); } - function test_e2e() public { + function test_e2e() public view { uint256 timestamp = block.timestamp - 60; bytes memory signature = _signProof(signerPk, "alice.fcast.id", timestamp, alice); bytes memory extraData = abi.encodeCall(IResolverService.resolve, (DNS_ENCODED_NAME, ADDR_QUERY_CALLDATA)); diff --git a/test/Deploy/DeployL2.t.sol b/test/Deploy/DeployL2.t.sol index c10e3d68..7434d2fa 100644 --- a/test/Deploy/DeployL2.t.sol +++ b/test/Deploy/DeployL2.t.sol @@ -114,7 +114,7 @@ contract DeployL2Test is DeployL2, Test { recoveryProxy = contracts.recoveryProxy; } - function test_deploymentParams() public { + function test_deploymentParams() public view { // Check deployment parameters assertEq(address(storageRegistry.priceFeed()), priceFeed); assertEq(address(storageRegistry.uptimeFeed()), uptimeFeed); @@ -227,7 +227,7 @@ contract DeployL2Test is DeployL2, Test { uint256 fid, address to, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idRegistry.hashTypedDataV4( keccak256(abi.encode(idRegistry.TRANSFER_TYPEHASH(), fid, to, idRegistry.nonces(signer), deadline)) @@ -242,7 +242,7 @@ contract DeployL2Test is DeployL2, Test { uint256 requestFid, bytes memory signerPubKey, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = validator.hashTypedDataV4( keccak256( abi.encode( diff --git a/test/Deploy/UpgradeL2.t.sol b/test/Deploy/UpgradeL2.t.sol index 2e77e757..b09a1630 100644 --- a/test/Deploy/UpgradeL2.t.sol +++ b/test/Deploy/UpgradeL2.t.sol @@ -128,7 +128,7 @@ contract UpgradeL2Test is UpgradeL2 { validator.setIdRegistry(address(idRegistry)); } - function test_deploymentParams() public { + function test_deploymentParams() public view { // Check deployment parameters assertEq(address(storageRegistry.priceFeed()), priceFeed); assertEq(address(storageRegistry.uptimeFeed()), uptimeFeed); @@ -329,7 +329,7 @@ contract UpgradeL2Test is UpgradeL2 { uint256 fid, address to, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { address signer = vm.addr(pk); bytes32 digest = idRegistry.hashTypedDataV4( keccak256(abi.encode(idRegistry.TRANSFER_TYPEHASH(), fid, to, idRegistry.nonces(signer), deadline)) @@ -344,7 +344,7 @@ contract UpgradeL2Test is UpgradeL2 { uint256 requestFid, bytes memory signerPubKey, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = validator.hashTypedDataV4( keccak256( abi.encode( diff --git a/test/FnameResolver/FnameResolver.t.sol b/test/FnameResolver/FnameResolver.t.sol index 52d11ba9..63716a75 100644 --- a/test/FnameResolver/FnameResolver.t.sol +++ b/test/FnameResolver/FnameResolver.t.sol @@ -13,19 +13,19 @@ contract FnameResolverTest is FnameResolverTestSuite { event AddSigner(address indexed signer); event RemoveSigner(address indexed signer); - function testURL() public { + function testURL() public view { assertEq(resolver.url(), FNAME_SERVER_URL); } - function testInitialOwner() public { + function testInitialOwner() public view { assertEq(resolver.owner(), owner); } - function testSignerIsAuthorized() public { + function testSignerIsAuthorized() public view { assertEq(resolver.signers(signer), true); } - function testVersion() public { + function testVersion() public view { assertEq(resolver.VERSION(), "2023.08.23"); } @@ -64,7 +64,7 @@ contract FnameResolverTest is FnameResolverTestSuite { RESOLVE WITH PROOF //////////////////////////////////////////////////////////////*/ - function testFuzzResolveWithProofValidSignature(string memory name, uint256 timestamp, address owner) public { + function testFuzzResolveWithProofValidSignature(string memory name, uint256 timestamp, address owner) public view { bytes memory signature = _signProof(name, timestamp, owner); bytes memory extraData = abi.encodeCall(IResolverService.resolve, (DNS_ENCODED_NAME, ADDR_QUERY_CALLDATA)); bytes memory response = resolver.resolveWithProof(abi.encode(name, timestamp, owner, signature), extraData); @@ -119,7 +119,7 @@ contract FnameResolverTest is FnameResolverTestSuite { resolver.resolveWithProof(abi.encode(name, timestamp, owner, signature), ""); } - function testProofTypehash() public { + function testProofTypehash() public view { assertEq( resolver.USERNAME_PROOF_TYPEHASH(), keccak256("UserNameProof(string name,uint256 timestamp,address owner)") ); @@ -129,7 +129,9 @@ contract FnameResolverTest is FnameResolverTestSuite { SIGNERS //////////////////////////////////////////////////////////////*/ - function testFuzzOwnerCanAddSigner(address signer) public { + function testFuzzOwnerCanAddSigner( + address signer + ) public { vm.expectEmit(true, false, false, false); emit AddSigner(signer); @@ -147,7 +149,9 @@ contract FnameResolverTest is FnameResolverTestSuite { resolver.addSigner(signer); } - function testFuzzOwnerCanRemoveSigner(address signer) public { + function testFuzzOwnerCanRemoveSigner( + address signer + ) public { vm.prank(owner); resolver.addSigner(signer); @@ -174,15 +178,17 @@ contract FnameResolverTest is FnameResolverTestSuite { INTERFACE DETECTION //////////////////////////////////////////////////////////////*/ - function testInterfaceDetectionIExtendedResolver() public { + function testInterfaceDetectionIExtendedResolver() public view { assertEq(resolver.supportsInterface(type(IExtendedResolver).interfaceId), true); } - function testInterfaceDetectionERC165() public { + function testInterfaceDetectionERC165() public view { assertEq(resolver.supportsInterface(type(IERC165).interfaceId), true); } - function testFuzzInterfaceDetectionUnsupportedInterface(bytes4 interfaceId) public { + function testFuzzInterfaceDetectionUnsupportedInterface( + bytes4 interfaceId + ) public view { vm.assume(interfaceId != type(IExtendedResolver).interfaceId && interfaceId != type(IERC165).interfaceId); assertEq(resolver.supportsInterface(interfaceId), false); } diff --git a/test/FnameResolver/FnameResolverTestSuite.sol b/test/FnameResolver/FnameResolverTestSuite.sol index 67f2ed68..8d2a7999 100644 --- a/test/FnameResolver/FnameResolverTestSuite.sol +++ b/test/FnameResolver/FnameResolverTestSuite.sol @@ -52,7 +52,7 @@ abstract contract FnameResolverTestSuite is TestSuiteSetup { string memory name, uint256 timestamp, address owner - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { return _signProof(signerPk, name, timestamp, owner); } @@ -61,7 +61,7 @@ abstract contract FnameResolverTestSuite is TestSuiteSetup { string memory name, uint256 timestamp, address owner - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 eip712hash = resolver.hashTypedDataV4( keccak256(abi.encode(resolver.USERNAME_PROOF_TYPEHASH(), keccak256(bytes(name)), timestamp, owner)) ); diff --git a/test/IdGateway/IdGateway.owner.t.sol b/test/IdGateway/IdGateway.owner.t.sol index 0e4f5f1c..3d4966e9 100644 --- a/test/IdGateway/IdGateway.owner.t.sol +++ b/test/IdGateway/IdGateway.owner.t.sol @@ -51,7 +51,9 @@ contract IdGatewayOwnerTest is IdGatewayTestSuite { ACCEPT OWNERSHIP //////////////////////////////////////////////////////////////*/ - function testFuzzAcceptOwnership(address newOwner) public { + function testFuzzAcceptOwnership( + address newOwner + ) public { vm.assume(newOwner != owner && newOwner != address(0)); vm.prank(owner); idGateway.transferOwnership(newOwner); @@ -93,7 +95,9 @@ contract IdGatewayOwnerTest is IdGatewayTestSuite { assertEq(idGateway.paused(), true); } - function testFuzzCannotPauseUnlessGuardian(address alice) public { + function testFuzzCannotPauseUnlessGuardian( + address alice + ) public { vm.assume(alice != owner && alice != address(0)); assertEq(idGateway.owner(), owner); assertEq(idGateway.paused(), false); @@ -116,7 +120,9 @@ contract IdGatewayOwnerTest is IdGatewayTestSuite { assertEq(idGateway.paused(), false); } - function testFuzzCannotUnpauseUnlessOwner(address alice) public { + function testFuzzCannotUnpauseUnlessOwner( + address alice + ) public { vm.assume(alice != owner && alice != address(0)); assertEq(idGateway.owner(), owner); diff --git a/test/IdGateway/IdGateway.t.sol b/test/IdGateway/IdGateway.t.sol index 6256008d..19f736e5 100644 --- a/test/IdGateway/IdGateway.t.sol +++ b/test/IdGateway/IdGateway.t.sol @@ -463,7 +463,7 @@ contract IdGatewayTest is IdGatewayTestSuite { vm.assume(storageRegistry != address(0)); vm.assume(uint160(storageRegistry) > 9); - // Mocks that the address is a contract + // Mock that the address is a contract vm.etch(storageRegistry, hex"00"); address prevStorageRegistry = address(idGateway.storageRegistry()); diff --git a/test/IdRegistry/IdRegistry.migration.t.sol b/test/IdRegistry/IdRegistry.migration.t.sol index e0ee11f2..8fa8f391 100644 --- a/test/IdRegistry/IdRegistry.migration.t.sol +++ b/test/IdRegistry/IdRegistry.migration.t.sol @@ -38,19 +38,19 @@ contract IdRegistryTest is IdRegistryTestSuite { PARAMETERS //////////////////////////////////////////////////////////////*/ - function testInitialGracePeriod() public { + function testInitialGracePeriod() public view { assertEq(idRegistry.gracePeriod(), 1 days); } - function testInitialMigrationTimestamp() public { + function testInitialMigrationTimestamp() public view { assertEq(idRegistry.migratedAt(), 0); } - function testInitialMigrator() public { + function testInitialMigrator() public view { assertEq(idRegistry.migrator(), migrator); } - function testInitialStateIsNotMigrated() public { + function testInitialStateIsNotMigrated() public view { assertEq(idRegistry.isMigrated(), false); } @@ -58,7 +58,9 @@ contract IdRegistryTest is IdRegistryTestSuite { SET MIGRATOR //////////////////////////////////////////////////////////////*/ - function testFuzzOwnerCanSetMigrator(address migrator) public { + function testFuzzOwnerCanSetMigrator( + address migrator + ) public { address oldMigrator = idRegistry.migrator(); vm.expectEmit(); @@ -69,7 +71,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.migrator(), migrator); } - function testFuzzSetMigratorRevertsWhenMigrated(address migrator) public { + function testFuzzSetMigratorRevertsWhenMigrated( + address migrator + ) public { address oldMigrator = idRegistry.migrator(); vm.prank(oldMigrator); @@ -82,7 +86,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.migrator(), oldMigrator); } - function testFuzzSetMigratorRevertsWhenUnpaused(address migrator) public { + function testFuzzSetMigratorRevertsWhenUnpaused( + address migrator + ) public { address oldMigrator = idRegistry.migrator(); vm.startPrank(owner); @@ -98,7 +104,9 @@ contract IdRegistryTest is IdRegistryTestSuite { MIGRATION //////////////////////////////////////////////////////////////*/ - function testFuzzMigration(uint40 timestamp) public { + function testFuzzMigration( + uint40 timestamp + ) public { vm.assume(timestamp != 0); vm.warp(timestamp); @@ -111,7 +119,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.migratedAt(), timestamp); } - function testFuzzOnlyMigratorCanMigrate(address caller) public { + function testFuzzOnlyMigratorCanMigrate( + address caller + ) public { vm.assume(caller != migrator); vm.prank(caller); @@ -122,7 +132,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.migratedAt(), 0); } - function testFuzzCannotMigrateTwice(uint40 timestamp) public { + function testFuzzCannotMigrateTwice( + uint40 timestamp + ) public { timestamp = uint40(bound(timestamp, 1, type(uint40).max)); vm.warp(timestamp); vm.prank(migrator); @@ -141,7 +153,9 @@ contract IdRegistryTest is IdRegistryTestSuite { SET COUNTER //////////////////////////////////////////////////////////////*/ - function testFuzzSetIdCounter(uint256 idCounter) public { + function testFuzzSetIdCounter( + uint256 idCounter + ) public { uint256 prevIdCounter = idRegistry.idCounter(); vm.expectEmit(); @@ -188,7 +202,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.idCounter(), prevIdCounter); } - function testFuzzSetIdCounterUnpausedReverts(uint256 idCounter) public { + function testFuzzSetIdCounterUnpausedReverts( + uint256 idCounter + ) public { uint256 prevIdCounter = idRegistry.idCounter(); vm.prank(owner); @@ -239,7 +255,9 @@ contract IdRegistryTest is IdRegistryTestSuite { idRegistry.bulkRegisterIds(registerItems); } - function testFuzzBulkRegisterDuringGracePeriod(uint40 _warpForward) public { + function testFuzzBulkRegisterDuringGracePeriod( + uint40 _warpForward + ) public { IdRegistry.BulkRegisterData[] memory registerItems = BulkRegisterDataBuilder.empty().addFid(1); uint256 warpForward = bound(_warpForward, 1, idRegistry.gracePeriod() - 1); @@ -253,7 +271,9 @@ contract IdRegistryTest is IdRegistryTestSuite { vm.stopPrank(); } - function testFuzzBulkRegisterAfterGracePeriodRevertsUnauthorized(uint40 _warpForward) public { + function testFuzzBulkRegisterAfterGracePeriodRevertsUnauthorized( + uint40 _warpForward + ) public { IdRegistry.BulkRegisterData[] memory registerItems = BulkRegisterDataBuilder.empty().addFid(1); uint256 warpForward = @@ -317,7 +337,9 @@ contract IdRegistryTest is IdRegistryTestSuite { } } - function testBulkRegisterWithRecoveryEmitsEvent(address recovery) public { + function testBulkRegisterWithRecoveryEmitsEvent( + address recovery + ) public { IIdRegistry.BulkRegisterDefaultRecoveryData[] memory registerItems = BulkRegisterDefaultRecoveryDataBuilder.empty().addFid(1).addFid(2).addFid(3); @@ -366,7 +388,9 @@ contract IdRegistryTest is IdRegistryTestSuite { vm.stopPrank(); } - function testBulkRegisterWithRecoveryCannotReRegister(address recovery) public { + function testBulkRegisterWithRecoveryCannotReRegister( + address recovery + ) public { IdRegistry.BulkRegisterDefaultRecoveryData[] memory registerItems = BulkRegisterDefaultRecoveryDataBuilder.empty().addFid(1).addFid(2).addFid(3); @@ -377,7 +401,9 @@ contract IdRegistryTest is IdRegistryTestSuite { vm.stopPrank(); } - function testBulkRegisterWithRecoveryUnpausedReverts(address recovery) public { + function testBulkRegisterWithRecoveryUnpausedReverts( + address recovery + ) public { IdRegistry.BulkRegisterDefaultRecoveryData[] memory registerItems = BulkRegisterDefaultRecoveryDataBuilder.empty().addFid(1).addFid(2).addFid(3); @@ -393,7 +419,9 @@ contract IdRegistryTest is IdRegistryTestSuite { BULK RESET //////////////////////////////////////////////////////////////*/ - function testFuzzBulkResetIds(uint24[] memory _ids) public { + function testFuzzBulkResetIds( + uint24[] memory _ids + ) public { vm.assume(_ids.length > 0); uint256 len = bound(_ids.length, 1, 100); @@ -442,7 +470,9 @@ contract IdRegistryTest is IdRegistryTestSuite { idRegistry.bulkResetIds(resetItems); } - function testFuzzBulkResetDuringGracePeriod(uint40 _warpForward) public { + function testFuzzBulkResetDuringGracePeriod( + uint40 _warpForward + ) public { IdRegistry.BulkRegisterData[] memory registerItems = BulkRegisterDataBuilder.empty().addFid(1).addFid(2).addFid(3); uint24[] memory resetItems = new uint24[](3); @@ -464,7 +494,9 @@ contract IdRegistryTest is IdRegistryTestSuite { vm.stopPrank(); } - function testFuzzBulkResetAfterGracePeriodRevertsUnauthorized(uint40 _warpForward) public { + function testFuzzBulkResetAfterGracePeriodRevertsUnauthorized( + uint40 _warpForward + ) public { uint24[] memory resetItems = new uint24[](3); uint256 warpForward = diff --git a/test/IdRegistry/IdRegistry.owner.t.sol b/test/IdRegistry/IdRegistry.owner.t.sol index 3c94eca6..341b2fd7 100644 --- a/test/IdRegistry/IdRegistry.owner.t.sol +++ b/test/IdRegistry/IdRegistry.owner.t.sol @@ -53,7 +53,9 @@ contract IdRegistryOwnerTest is IdRegistryTestSuite { ACCEPT OWNERSHIP //////////////////////////////////////////////////////////////*/ - function testFuzzAcceptOwnership(address newOwner) public { + function testFuzzAcceptOwnership( + address newOwner + ) public { vm.assume(newOwner != owner && newOwner != address(0)); vm.prank(owner); idRegistry.transferOwnership(newOwner); @@ -93,7 +95,9 @@ contract IdRegistryOwnerTest is IdRegistryTestSuite { _pause(); } - function testAddRemoveGuardian(address guardian) public { + function testAddRemoveGuardian( + address guardian + ) public { assertEq(idRegistry.guardians(guardian), false); vm.expectEmit(); @@ -113,7 +117,9 @@ contract IdRegistryOwnerTest is IdRegistryTestSuite { assertEq(idRegistry.guardians(guardian), false); } - function testFuzzCannotPauseUnlessGuardian(address alice) public { + function testFuzzCannotPauseUnlessGuardian( + address alice + ) public { vm.assume(alice != owner && alice != address(0)); assertEq(idRegistry.owner(), owner); assertEq(idRegistry.paused(), false); @@ -134,7 +140,9 @@ contract IdRegistryOwnerTest is IdRegistryTestSuite { assertEq(idRegistry.paused(), false); } - function testFuzzCannotUnpauseUnlessOwner(address alice) public { + function testFuzzCannotUnpauseUnlessOwner( + address alice + ) public { vm.assume(alice != owner && alice != address(0)); assertEq(idRegistry.owner(), owner); _pause(); diff --git a/test/IdRegistry/IdRegistry.symbolic.t.sol b/test/IdRegistry/IdRegistry.symbolic.t.sol index c1257eca..40e8877f 100644 --- a/test/IdRegistry/IdRegistry.symbolic.t.sol +++ b/test/IdRegistry/IdRegistry.symbolic.t.sol @@ -180,7 +180,9 @@ contract IdRegistrySymTest is SymTest, Test { /** * @dev Generates valid calldata for a given function selector. */ - function _calldataFor(bytes4 selector) internal returns (bytes memory) { + function _calldataFor( + bytes4 selector + ) internal returns (bytes memory) { bytes memory args; if (selector == idRegistry.transfer.selector) { args = abi.encode(svm.createAddress("to"), svm.createUint256("deadline"), svm.createBytes(65, "sig")); diff --git a/test/IdRegistry/IdRegistry.t.sol b/test/IdRegistry/IdRegistry.t.sol index 9660a014..2805c5c3 100644 --- a/test/IdRegistry/IdRegistry.t.sol +++ b/test/IdRegistry/IdRegistry.t.sol @@ -32,11 +32,11 @@ contract IdRegistryTest is IdRegistryTestSuite { PARAMETERS //////////////////////////////////////////////////////////////*/ - function testVersion() public { + function testVersion() public view { assertEq(idRegistry.VERSION(), "2023.11.15"); } - function testName() public { + function testName() public view { assertEq(idRegistry.name(), "Farcaster FID"); } @@ -367,7 +367,7 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.idOf(to), 1); } - function testTransferTypehash() public { + function testTransferTypehash() public view { assertEq( idRegistry.TRANSFER_TYPEHASH(), keccak256("Transfer(uint256 fid,address to,uint256 nonce,uint256 deadline)") ); @@ -1094,7 +1094,7 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.recoveryOf(fid), address(0)); } - function testTransferAndChangeRecoveryTypehash() public { + function testTransferAndChangeRecoveryTypehash() public view { assertEq( idRegistry.TRANSFER_AND_CHANGE_RECOVERY_TYPEHASH(), keccak256( @@ -2591,7 +2591,9 @@ contract IdRegistryTest is IdRegistryTestSuite { SET ID GATEWAY //////////////////////////////////////////////////////////////*/ - function testFuzzSetIdGateway(address idGateway) public { + function testFuzzSetIdGateway( + address idGateway + ) public { address prevIdGateway = idRegistry.idGateway(); vm.expectEmit(); @@ -2611,7 +2613,9 @@ contract IdRegistryTest is IdRegistryTestSuite { idRegistry.setIdGateway(idGateway); } - function testFuzzFreezeIdGateway(address idGateway) public { + function testFuzzFreezeIdGateway( + address idGateway + ) public { assertEq(idRegistry.gatewayFrozen(), false); vm.prank(owner); @@ -2626,7 +2630,9 @@ contract IdRegistryTest is IdRegistryTestSuite { assertEq(idRegistry.gatewayFrozen(), true); } - function testFuzzOnlyOwnerCanFreezeIdGateway(address caller) public { + function testFuzzOnlyOwnerCanFreezeIdGateway( + address caller + ) public { vm.assume(caller != owner); vm.expectRevert("Ownable: caller is not the owner"); @@ -2634,7 +2640,9 @@ contract IdRegistryTest is IdRegistryTestSuite { idRegistry.freezeIdGateway(); } - function testFuzzSetIdGatewayRevertsWhenFrozen(address idGateway) public { + function testFuzzSetIdGatewayRevertsWhenFrozen( + address idGateway + ) public { assertEq(idRegistry.gatewayFrozen(), false); vm.prank(owner); diff --git a/test/IdRegistry/IdRegistryTestHelpers.sol b/test/IdRegistry/IdRegistryTestHelpers.sol index fbd42e14..69ef92f0 100644 --- a/test/IdRegistry/IdRegistryTestHelpers.sol +++ b/test/IdRegistry/IdRegistryTestHelpers.sol @@ -23,11 +23,15 @@ library BulkRegisterDataBuilder { return newData; } - function custodyOf(uint24 fid) internal pure returns (address) { + function custodyOf( + uint24 fid + ) internal pure returns (address) { return address(uint160(uint256(keccak256(abi.encodePacked(fid))))); } - function recoveryOf(uint24 fid) internal pure returns (address) { + function recoveryOf( + uint24 fid + ) internal pure returns (address) { return address(uint160(uint256(keccak256(abi.encodePacked(keccak256(abi.encodePacked(fid))))))); } } @@ -51,7 +55,9 @@ library BulkRegisterDefaultRecoveryDataBuilder { return newData; } - function custodyOf(uint24 fid) internal pure returns (address) { + function custodyOf( + uint24 fid + ) internal pure returns (address) { return address(uint160(uint256(keccak256(abi.encodePacked(fid))))); } } diff --git a/test/KeyGateway/KeyGateway.t.sol b/test/KeyGateway/KeyGateway.t.sol index 50933d8b..ef2440a0 100644 --- a/test/KeyGateway/KeyGateway.t.sol +++ b/test/KeyGateway/KeyGateway.t.sol @@ -25,7 +25,7 @@ contract KeyGatewayTest is KeyGatewayTestSuite { event SetVault(address oldVault, address newVault); event Withdraw(address indexed to, uint256 amount); - function testVersion() public { + function testVersion() public view { assertEq(keyGateway.VERSION(), "2023.11.15"); } @@ -428,7 +428,9 @@ contract KeyGatewayTest is KeyGatewayTestSuite { PAUSE //////////////////////////////////////////////////////////////*/ - function testFuzzOnlyAuthorizedCanPause(address caller) public { + function testFuzzOnlyAuthorizedCanPause( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -436,7 +438,9 @@ contract KeyGatewayTest is KeyGatewayTestSuite { keyGateway.pause(); } - function testFuzzOnlyOwnerCanUnpause(address caller) public { + function testFuzzOnlyOwnerCanUnpause( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -454,7 +458,9 @@ contract KeyGatewayTest is KeyGatewayTestSuite { assertEq(keyGateway.paused(), false); } - function testFuzzPauseUnpauseGuardian(address caller) public { + function testFuzzPauseUnpauseGuardian( + address caller + ) public { vm.assume(caller != owner); vm.prank(owner); @@ -478,22 +484,22 @@ contract KeyGatewayTest is KeyGatewayTestSuite { return idRegistry.register(to, recovery); } - function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal { + function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal pure { assertEq(uint8(a), uint8(b)); } - function assertNull(uint256 fid, bytes memory key) internal { + function assertNull(uint256 fid, bytes memory key) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.NULL); assertEq(keyRegistry.keyDataOf(fid, key).keyType, 0); assertEq(keyRegistry.totalKeys(fid, IKeyRegistry.KeyState.ADDED), 0); } - function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.ADDED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } - function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.REMOVED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } diff --git a/test/KeyGateway/KeyGatewayTestSuite.sol b/test/KeyGateway/KeyGatewayTestSuite.sol index 00085e13..9378dd56 100644 --- a/test/KeyGateway/KeyGatewayTestSuite.sol +++ b/test/KeyGateway/KeyGatewayTestSuite.sol @@ -32,7 +32,7 @@ abstract contract KeyGatewayTestSuite is KeyRegistryTestSuite, StorageRegistryTe uint8 metadataType, bytes memory metadata, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { return _signAdd(pk, owner, keyType, key, metadataType, metadata, keyGateway.nonces(owner), deadline); } @@ -45,7 +45,7 @@ abstract contract KeyGatewayTestSuite is KeyRegistryTestSuite, StorageRegistryTe bytes memory metadata, uint256 nonce, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = keyGateway.hashTypedDataV4( keccak256( abi.encode( diff --git a/test/KeyRegistry/KeyRegistry.integration.t.sol b/test/KeyRegistry/KeyRegistry.integration.t.sol index cba5505b..75375ea7 100644 --- a/test/KeyRegistry/KeyRegistry.integration.t.sol +++ b/test/KeyRegistry/KeyRegistry.integration.t.sol @@ -176,16 +176,16 @@ contract KeyRegistryIntegrationTest is KeyRegistryTestSuite, SignedKeyRequestVal return idRegistry.register(to, recovery); } - function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal { + function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal pure { assertEq(uint8(a), uint8(b)); } - function assertNull(uint256 fid, bytes memory key) internal { + function assertNull(uint256 fid, bytes memory key) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.NULL); assertEq(keyRegistry.keyDataOf(fid, key).keyType, 0); } - function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.ADDED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } diff --git a/test/KeyRegistry/KeyRegistry.migration.t.sol b/test/KeyRegistry/KeyRegistry.migration.t.sol index 1b4ed9a4..3945c21c 100644 --- a/test/KeyRegistry/KeyRegistry.migration.t.sol +++ b/test/KeyRegistry/KeyRegistry.migration.t.sol @@ -35,19 +35,19 @@ contract KeyRegistryTest is KeyRegistryTestSuite { event Migrated(uint256 indexed migratedAt); event SetMigrator(address oldMigrator, address newMigrator); - function testInitialGracePeriod() public { + function testInitialGracePeriod() public view { assertEq(keyRegistry.gracePeriod(), 1 days); } - function testInitialMigrationTimestamp() public { + function testInitialMigrationTimestamp() public view { assertEq(keyRegistry.migratedAt(), 0); } - function testInitialMigrator() public { + function testInitialMigrator() public view { assertEq(keyRegistry.migrator(), migrator); } - function testInitialStateIsNotMigrated() public { + function testInitialStateIsNotMigrated() public view { assertEq(keyRegistry.isMigrated(), false); } @@ -55,7 +55,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { SET MIGRATOR //////////////////////////////////////////////////////////////*/ - function testFuzzOwnerCanSetMigrator(address migrator) public { + function testFuzzOwnerCanSetMigrator( + address migrator + ) public { address oldMigrator = keyRegistry.migrator(); vm.expectEmit(); @@ -66,7 +68,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(keyRegistry.migrator(), migrator); } - function testFuzzSetMigratorRevertsWhenMigrated(address migrator) public { + function testFuzzSetMigratorRevertsWhenMigrated( + address migrator + ) public { address oldMigrator = keyRegistry.migrator(); vm.prank(oldMigrator); @@ -79,7 +83,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(keyRegistry.migrator(), oldMigrator); } - function testFuzzSetMigratorRevertsWhenUnpaused(address migrator) public { + function testFuzzSetMigratorRevertsWhenUnpaused( + address migrator + ) public { address oldMigrator = keyRegistry.migrator(); vm.startPrank(owner); @@ -95,7 +101,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { MIGRATION //////////////////////////////////////////////////////////////*/ - function testFuzzMigration(uint40 timestamp) public { + function testFuzzMigration( + uint40 timestamp + ) public { vm.assume(timestamp != 0); vm.warp(timestamp); @@ -108,7 +116,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(keyRegistry.migratedAt(), timestamp); } - function testFuzzOnlyMigratorCanMigrate(address caller) public { + function testFuzzOnlyMigratorCanMigrate( + address caller + ) public { vm.assume(caller != migrator); vm.prank(caller); @@ -119,7 +129,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(keyRegistry.migratedAt(), 0); } - function testFuzzCannotMigrateTwice(uint40 timestamp) public { + function testFuzzCannotMigrateTwice( + uint40 timestamp + ) public { timestamp = uint40(bound(timestamp, 1, type(uint40).max)); vm.warp(timestamp); vm.prank(migrator); @@ -186,7 +198,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { keyRegistry.bulkAddKeysForMigration(addItems); } - function testFuzzBulkAddKeyForMigrationDuringGracePeriod(uint40 _warpForward) public { + function testFuzzBulkAddKeyForMigrationDuringGracePeriod( + uint40 _warpForward + ) public { _registerValidator(1, 1); KeyRegistry.BulkAddData[] memory addItems = BulkAddDataBuilder.empty().addFid(1).addKey(0, "key1", "metadata1"); @@ -203,7 +217,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { vm.stopPrank(); } - function testFuzzBulkAddSignerForMigrationAfterGracePeriodRevertsUnauthorized(uint40 _warpForward) public { + function testFuzzBulkAddSignerForMigrationAfterGracePeriodRevertsUnauthorized( + uint40 _warpForward + ) public { KeyRegistry.BulkAddData[] memory addItems = BulkAddDataBuilder.empty().addFid(1).addKey(0, "key1", "metadata1"); uint256 warpForward = @@ -364,7 +380,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { vm.stopPrank(); } - function testFuzzBulkRemoveSignerForMigrationDuringGracePeriod(uint40 _warpForward) public { + function testFuzzBulkRemoveSignerForMigrationDuringGracePeriod( + uint40 _warpForward + ) public { _registerValidator(1, 1); KeyRegistry.BulkAddData[] memory addItems = BulkAddDataBuilder.empty().addFid(1).addKey(0, "key", "metadata"); @@ -384,7 +402,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { vm.stopPrank(); } - function testFuzzBulkRemoveSignerForMigrationAfterGracePeriodRevertsUnauthorized(uint40 _warpForward) public { + function testFuzzBulkRemoveSignerForMigrationAfterGracePeriodRevertsUnauthorized( + uint40 _warpForward + ) public { KeyRegistry.BulkResetData[] memory items = BulkResetDataBuilder.empty().addFid(1).addKey(0, "key"); uint256 warpForward = @@ -421,22 +441,22 @@ contract KeyRegistryTest is KeyRegistryTestSuite { return idRegistry.register(to, recovery); } - function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal { + function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal pure { assertEq(uint8(a), uint8(b)); } - function assertNull(uint256 fid, bytes memory key) internal { + function assertNull(uint256 fid, bytes memory key) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.NULL); assertEq(keyRegistry.keyDataOf(fid, key).keyType, 0); assertEq(keyRegistry.totalKeys(fid, IKeyRegistry.KeyState.ADDED), 0); } - function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.ADDED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } - function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.REMOVED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } diff --git a/test/KeyRegistry/KeyRegistry.symbolic.t.sol b/test/KeyRegistry/KeyRegistry.symbolic.t.sol index efd40f8f..e19a06e7 100644 --- a/test/KeyRegistry/KeyRegistry.symbolic.t.sol +++ b/test/KeyRegistry/KeyRegistry.symbolic.t.sol @@ -171,7 +171,9 @@ contract KeyRegistrySymTest is SymTest, Test { } // Case-splitting tactic: explicitly branching into two states: cond vs !cond - function split_cases(bool cond) internal pure { + function split_cases( + bool cond + ) internal pure { if (cond) return; } diff --git a/test/KeyRegistry/KeyRegistry.t.sol b/test/KeyRegistry/KeyRegistry.t.sol index 40837525..a459d448 100644 --- a/test/KeyRegistry/KeyRegistry.t.sol +++ b/test/KeyRegistry/KeyRegistry.t.sol @@ -35,15 +35,15 @@ contract KeyRegistryTest is KeyRegistryTestSuite { event SetMaxKeysPerFid(uint256 oldMax, uint256 newMax); event FreezeKeyGateway(address keyGateway); - function testInitialIdRegistry() public { + function testInitialIdRegistry() public view { assertEq(address(keyRegistry.idRegistry()), address(idRegistry)); } - function testInitialOwner() public { + function testInitialOwner() public view { assertEq(keyRegistry.owner(), owner); } - function testVersion() public { + function testVersion() public view { assertEq(keyRegistry.VERSION(), "2023.11.15"); } @@ -608,7 +608,7 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertAdded(fid, key, keyType); } - function testRemoveTypeHash() public { + function testRemoveTypeHash() public view { assertEq( keyRegistry.REMOVE_TYPEHASH(), keccak256("Remove(address owner,bytes key,uint256 nonce,uint256 deadline)") ); @@ -618,7 +618,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { PAUSABILITY //////////////////////////////////////////////////////////////*/ - function testFuzzOnlyAdminCanPause(address caller) public { + function testFuzzOnlyAdminCanPause( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -652,7 +654,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { keyRegistry.setIdRegistry(idRegistry); } - function testFuzzSetIdRegistry(address idRegistry) public { + function testFuzzSetIdRegistry( + address idRegistry + ) public { address currentIdRegistry = address(keyRegistry.idRegistry()); vm.expectEmit(false, false, false, true); @@ -724,7 +728,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { keyRegistry.setMaxKeysPerFid(newMax); } - function testFuzzSetMaxKeysPerFid(uint256 newMax) public { + function testFuzzSetMaxKeysPerFid( + uint256 newMax + ) public { uint256 currentMax = keyRegistry.maxKeysPerFid(); newMax = bound(newMax, currentMax + 1, type(uint256).max); @@ -737,7 +743,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(keyRegistry.maxKeysPerFid(), newMax); } - function testFuzzSetMaxKeysPerFidRevertsLessThanOrEqualToCurrentMax(uint256 newMax) public { + function testFuzzSetMaxKeysPerFidRevertsLessThanOrEqualToCurrentMax( + uint256 newMax + ) public { uint256 currentMax = keyRegistry.maxKeysPerFid(); newMax = bound(newMax, 0, currentMax); @@ -760,7 +768,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { keyRegistry.setKeyGateway(keyGateway); } - function testFuzzSetKeyGateway(address keyGateway) public { + function testFuzzSetKeyGateway( + address keyGateway + ) public { address currentKeyGateway = address(keyRegistry.keyGateway()); vm.expectEmit(false, false, false, true); @@ -772,7 +782,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { assertEq(address(keyRegistry.keyGateway()), keyGateway); } - function testFuzzSetKeyGatewayRevertsWhenFrozen(address keyGateway) public { + function testFuzzSetKeyGatewayRevertsWhenFrozen( + address keyGateway + ) public { address currentKeyGateway = address(keyRegistry.keyGateway()); vm.prank(owner); @@ -794,7 +806,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { keyRegistry.freezeKeyGateway(); } - function testOnlyOwnerCanFreezeKeyGateway(address caller) public { + function testOnlyOwnerCanFreezeKeyGateway( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -1108,7 +1122,9 @@ contract KeyRegistryTest is KeyRegistryTestSuite { HELPERS //////////////////////////////////////////////////////////////*/ - function _makeKey(uint256 i) internal pure returns (bytes memory key, bytes memory metadata) { + function _makeKey( + uint256 i + ) internal pure returns (bytes memory key, bytes memory metadata) { key = abi.encodePacked(keccak256(abi.encodePacked("key", i))); metadata = abi.encodePacked(keccak256(abi.encodePacked("metadata", i))); } @@ -1118,22 +1134,22 @@ contract KeyRegistryTest is KeyRegistryTestSuite { return idRegistry.register(to, recovery); } - function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal { + function assertEq(IKeyRegistry.KeyState a, IKeyRegistry.KeyState b) internal pure { assertEq(uint8(a), uint8(b)); } - function assertNull(uint256 fid, bytes memory key) internal { + function assertNull(uint256 fid, bytes memory key) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.NULL); assertEq(keyRegistry.keyDataOf(fid, key).keyType, 0); assertEq(keyRegistry.totalKeys(fid, IKeyRegistry.KeyState.ADDED), 0); } - function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertAdded(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.ADDED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } - function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal { + function assertRemoved(uint256 fid, bytes memory key, uint32 keyType) internal view { assertEq(keyRegistry.keyDataOf(fid, key).state, IKeyRegistry.KeyState.REMOVED); assertEq(keyRegistry.keyDataOf(fid, key).keyType, keyType); } diff --git a/test/KeyRegistry/KeyRegistryTestHelpers.sol b/test/KeyRegistry/KeyRegistryTestHelpers.sol index e89ee05d..13144856 100644 --- a/test/KeyRegistry/KeyRegistryTestHelpers.sol +++ b/test/KeyRegistry/KeyRegistryTestHelpers.sol @@ -42,9 +42,7 @@ library BulkAddDataBuilder { bytes memory metadata ) internal pure returns (KeyRegistry.BulkAddData[] memory) { KeyRegistry.BulkAddKey[] memory keys = addData[index].keys; - KeyRegistry.BulkAddKey[] memory newKeys = new KeyRegistry.BulkAddKey[]( - keys.length + 1 - ); + KeyRegistry.BulkAddKey[] memory newKeys = new KeyRegistry.BulkAddKey[](keys.length + 1); for (uint256 i; i < keys.length; i++) { newKeys[i] = keys[i]; @@ -65,9 +63,7 @@ library BulkResetDataBuilder { KeyRegistry.BulkResetData[] memory resetData, uint256 fid ) internal pure returns (KeyRegistry.BulkResetData[] memory) { - KeyRegistry.BulkResetData[] memory newData = new KeyRegistry.BulkResetData[]( - resetData.length + 1 - ); + KeyRegistry.BulkResetData[] memory newData = new KeyRegistry.BulkResetData[](resetData.length + 1); for (uint256 i; i < resetData.length; i++) { newData[i] = resetData[i]; } diff --git a/test/RecoveryProxy/RecoveryProxy.t.sol b/test/RecoveryProxy/RecoveryProxy.t.sol index ffdf326a..c249d3eb 100644 --- a/test/RecoveryProxy/RecoveryProxy.t.sol +++ b/test/RecoveryProxy/RecoveryProxy.t.sol @@ -9,11 +9,11 @@ import {RecoveryProxyTestSuite} from "./RecoveryProxyTestSuite.sol"; contract RecoveryProxyTest is RecoveryProxyTestSuite { event SetIdRegistry(address oldIdRegistry, address newIdRegistry); - function testIdRegistry() public { + function testIdRegistry() public view { assertEq(address(recoveryProxy.idRegistry()), address(idRegistry)); } - function testInitialOwner() public { + function testInitialOwner() public view { assertEq(recoveryProxy.owner(), owner); } @@ -106,7 +106,9 @@ contract RecoveryProxyTest is RecoveryProxyTestSuite { recoveryProxy.setIdRegistry(_idRegistry); } - function testFuzzSetIdRegistry(IIdRegistry newIdRegistry) public { + function testFuzzSetIdRegistry( + IIdRegistry newIdRegistry + ) public { IIdRegistry currentIdRegistry = recoveryProxy.idRegistry(); vm.expectEmit(false, false, false, true); diff --git a/test/StorageRegistry/StorageRegistry.t.sol b/test/StorageRegistry/StorageRegistry.t.sol index cab90bb0..36933c61 100644 --- a/test/StorageRegistry/StorageRegistry.t.sol +++ b/test/StorageRegistry/StorageRegistry.t.sol @@ -38,85 +38,87 @@ contract StorageRegistryTest is StorageRegistryTestSuite { INITIALIZED VALUES //////////////////////////////////////////////////////////////*/ - function testVersion() public { + function testVersion() public view { assertEq(storageRegistry.VERSION(), "2023.08.23"); } - function testRoles() public { + function testRoles() public view { assertEq(storageRegistry.ownerRoleId(), keccak256("OWNER_ROLE")); assertEq(storageRegistry.operatorRoleId(), keccak256("OPERATOR_ROLE")); assertEq(storageRegistry.treasurerRoleId(), keccak256("TREASURER_ROLE")); } - function testDefaultAdmin() public { + function testDefaultAdmin() public view { assertTrue(storageRegistry.hasRole(storageRegistry.DEFAULT_ADMIN_ROLE(), roleAdmin)); } - function testPriceFeedDefault() public { + function testPriceFeedDefault() public view { assertEq(address(storageRegistry.priceFeed()), address(priceFeed)); } - function testUptimeFeedDefault() public { + function testUptimeFeedDefault() public view { assertEq(address(storageRegistry.uptimeFeed()), address(uptimeFeed)); } - function testDeprecationTimestampDefault() public { + function testDeprecationTimestampDefault() public view { assertEq(storageRegistry.deprecationTimestamp(), DEPLOYED_AT + INITIAL_RENTAL_PERIOD); } - function testUsdUnitPriceDefault() public { + function testUsdUnitPriceDefault() public view { assertEq(storageRegistry.usdUnitPrice(), INITIAL_USD_UNIT_PRICE); } - function testMaxUnitsDefault() public { + function testMaxUnitsDefault() public view { assertEq(storageRegistry.maxUnits(), INITIAL_MAX_UNITS); } - function testRentedUnitsDefault() public { + function testRentedUnitsDefault() public view { assertEq(storageRegistry.rentedUnits(), 0); } - function testEthUSDPriceDefault() public { + function testEthUSDPriceDefault() public view { assertEq(storageRegistry.ethUsdPrice(), uint256(ETH_USD_PRICE)); } - function testPrevEthUSDPriceDefault() public { + function testPrevEthUSDPriceDefault() public view { assertEq(storageRegistry.prevEthUsdPrice(), uint256(ETH_USD_PRICE)); } - function testLastPriceFeedUpdateDefault() public { + function testLastPriceFeedUpdateDefault() public view { assertEq(storageRegistry.lastPriceFeedUpdateTime(), block.timestamp); } - function testLastPriceFeedUpdateBlockDefault() public { + function testLastPriceFeedUpdateBlockDefault() public view { assertEq(storageRegistry.lastPriceFeedUpdateBlock(), block.number); } - function testPriceFeedCacheDurationDefault() public { + function testPriceFeedCacheDurationDefault() public view { assertEq(storageRegistry.priceFeedCacheDuration(), INITIAL_PRICE_FEED_CACHE_DURATION); } - function testPriceFeedMaxAgeDefault() public { + function testPriceFeedMaxAgeDefault() public view { assertEq(storageRegistry.priceFeedMaxAge(), INITIAL_PRICE_FEED_MAX_AGE); } - function testPriceFeedMinAnswerDefault() public { + function testPriceFeedMinAnswerDefault() public view { assertEq(storageRegistry.priceFeedMinAnswer(), INITIAL_PRICE_FEED_MIN_ANSWER); } - function testPriceFeedMaxAnswerDefault() public { + function testPriceFeedMaxAnswerDefault() public view { assertEq(storageRegistry.priceFeedMaxAnswer(), INITIAL_PRICE_FEED_MAX_ANSWER); } - function testUptimeFeedGracePeriodDefault() public { + function testUptimeFeedGracePeriodDefault() public view { assertEq(storageRegistry.uptimeFeedGracePeriod(), INITIAL_UPTIME_FEED_GRACE_PERIOD); } - function testFuzzInitialPrice(uint128 quantity) public { + function testFuzzInitialPrice( + uint128 quantity + ) public view { assertEq(storageRegistry.price(quantity), INITIAL_PRICE_IN_ETH * quantity); } - function testInitialUnitPrice() public { + function testInitialUnitPrice() public view { assertEq(storageRegistry.unitPrice(), INITIAL_PRICE_IN_ETH); } @@ -992,7 +994,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { PRICE FEED //////////////////////////////////////////////////////////////*/ - function testFuzzPriceFeedRevertsInvalidPrice(int256 price) public { + function testFuzzPriceFeedRevertsInvalidPrice( + int256 price + ) public { // Ensure price is zero or negative price = price > 0 ? -price : price; priceFeed.setPrice(price); @@ -1035,7 +1039,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.refreshPrice(); } - function testFuzzPriceFeedRevertsAnswerBelowBound(uint256 delta) public { + function testFuzzPriceFeedRevertsAnswerBelowBound( + uint256 delta + ) public { delta = bound(delta, 1, uint256(storageRegistry.priceFeedMinAnswer()) - 1); priceFeed.setRoundData( @@ -1053,7 +1059,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.refreshPrice(); } - function testPriceFeedRevertsAnswerAboveBound(uint256 delta) public { + function testPriceFeedRevertsAnswerAboveBound( + uint256 delta + ) public { delta = bound(delta, 1, uint256(type(int256).max) - storageRegistry.priceFeedMaxAnswer()); priceFeed.setRoundData( @@ -1154,7 +1162,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { UPTIME FEED //////////////////////////////////////////////////////////////*/ - function testFuzzUptimeFeedRevertsSequencerDown(int256 answer) public { + function testFuzzUptimeFeedRevertsSequencerDown( + int256 answer + ) public { if (answer == 0) ++answer; // Set nonzero answer. It's counterintuitive, but a zero answer // means the sequencer is up. @@ -1190,7 +1200,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.refreshPrice(); } - function testFuzzUptimeFeedRevertsInvalidTimestamp(uint256 secondsAhead) public { + function testFuzzUptimeFeedRevertsInvalidTimestamp( + uint256 secondsAhead + ) public { secondsAhead = bound(secondsAhead, 1, type(uint256).max - block.timestamp); // Set timestamp in future @@ -1290,7 +1302,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { REFRESH PRICE //////////////////////////////////////////////////////////////*/ - function testFuzzOnlyAuthorizedCanRefreshPrice(address caller) public { + function testFuzzOnlyAuthorizedCanRefreshPrice( + address caller + ) public { vm.assume(caller != owner && caller != treasurer); vm.prank(caller); @@ -1344,7 +1358,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.credit(fid, units); } - function testFuzzCreditRevertsZeroUnits(uint256 fid) public { + function testFuzzCreditRevertsZeroUnits( + uint256 fid + ) public { vm.expectRevert(StorageRegistry.InvalidAmount.selector); vm.prank(operator); storageRegistry.credit(fid, 0); @@ -1367,7 +1383,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { _batchCreditStorage(fids, units); } - function testFuzzBatchCreditRevertsZeroAmount(uint256[] calldata fids) public { + function testFuzzBatchCreditRevertsZeroAmount( + uint256[] calldata fids + ) public { vm.expectRevert(StorageRegistry.InvalidAmount.selector); vm.prank(operator); storageRegistry.batchCredit(fids, 0); @@ -1510,7 +1528,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setPriceFeed(AggregatorV3Interface(newFeed)); } - function testFuzzSetPriceFeed(address newFeed) public { + function testFuzzSetPriceFeed( + address newFeed + ) public { AggregatorV3Interface currentFeed = storageRegistry.priceFeed(); vm.expectEmit(); @@ -1530,7 +1550,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setUptimeFeed(AggregatorV3Interface(newFeed)); } - function testFuzzSetUptimeFeed(address newFeed) public { + function testFuzzSetUptimeFeed( + address newFeed + ) public { AggregatorV3Interface currentFeed = storageRegistry.uptimeFeed(); vm.expectEmit(); @@ -1554,7 +1576,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setPrice(unitPrice); } - function testFuzzSetUSDUnitPrice(uint256 unitPrice) public { + function testFuzzSetUSDUnitPrice( + uint256 unitPrice + ) public { uint256 currentPrice = storageRegistry.usdUnitPrice(); vm.expectEmit(false, false, false, true); @@ -1578,7 +1602,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setFixedEthUsdPrice(fixedPrice); } - function testFuzzSetFixedEthUsdPrice(uint256 fixedPrice) public { + function testFuzzSetFixedEthUsdPrice( + uint256 fixedPrice + ) public { fixedPrice = bound(fixedPrice, storageRegistry.priceFeedMinAnswer(), storageRegistry.priceFeedMaxAnswer()); assertEq(storageRegistry.fixedEthUsdPrice(), 0); @@ -1591,7 +1617,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(storageRegistry.fixedEthUsdPrice(), fixedPrice); } - function testFuzzSetFixedEthUsdPriceRevertsLessThanMinPrice(uint256 fixedPrice) public { + function testFuzzSetFixedEthUsdPriceRevertsLessThanMinPrice( + uint256 fixedPrice + ) public { fixedPrice = bound(fixedPrice, 1, storageRegistry.priceFeedMinAnswer() - 1); assertEq(storageRegistry.fixedEthUsdPrice(), 0); @@ -1600,7 +1628,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setFixedEthUsdPrice(fixedPrice); } - function testFuzzSetFixedEthUsdPriceRevertsGreaterThanMaxPrice(uint256 fixedPrice) public { + function testFuzzSetFixedEthUsdPriceRevertsGreaterThanMaxPrice( + uint256 fixedPrice + ) public { fixedPrice = bound(fixedPrice, storageRegistry.priceFeedMaxAnswer() + 1, type(uint256).max); assertEq(storageRegistry.fixedEthUsdPrice(), 0); @@ -1609,7 +1639,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setFixedEthUsdPrice(fixedPrice); } - function testFuzzSetFixedEthUsdPriceOverridesPriceFeed(uint256 fixedPrice) public { + function testFuzzSetFixedEthUsdPriceOverridesPriceFeed( + uint256 fixedPrice + ) public { fixedPrice = bound(fixedPrice, storageRegistry.priceFeedMinAnswer(), storageRegistry.priceFeedMaxAnswer()); vm.assume(fixedPrice != storageRegistry.ethUsdPrice()); fixedPrice = bound(fixedPrice, 1, type(uint256).max); @@ -1626,7 +1658,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(priceAfter, usdUnitPrice.divWadUp(fixedPrice)); } - function testFuzzRemoveFixedEthUsdPriceReenablesPriceFeed(uint256 fixedPrice) public { + function testFuzzRemoveFixedEthUsdPriceReenablesPriceFeed( + uint256 fixedPrice + ) public { fixedPrice = bound(fixedPrice, storageRegistry.priceFeedMinAnswer(), storageRegistry.priceFeedMaxAnswer()); vm.assume(fixedPrice != storageRegistry.ethUsdPrice()); fixedPrice = bound(fixedPrice, 1, type(uint256).max); @@ -1662,7 +1696,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setMaxUnits(maxUnits); } - function testFuzzSetMaxUnitsEmitsEvent(uint256 maxUnits) public { + function testFuzzSetMaxUnitsEmitsEvent( + uint256 maxUnits + ) public { uint256 currentMax = storageRegistry.maxUnits(); vm.expectEmit(false, false, false, true); @@ -1686,7 +1722,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setDeprecationTimestamp(timestamp); } - function testFuzzSetDeprecationTime(uint256 timestamp) public { + function testFuzzSetDeprecationTime( + uint256 timestamp + ) public { timestamp = bound(timestamp, block.timestamp, type(uint256).max); uint256 currentEnd = storageRegistry.deprecationTimestamp(); @@ -1699,7 +1737,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(storageRegistry.deprecationTimestamp(), timestamp); } - function testFuzzSetDeprecationTimeRevertsInPast(uint256 timestamp) public { + function testFuzzSetDeprecationTimeRevertsInPast( + uint256 timestamp + ) public { timestamp = bound(timestamp, 1, type(uint256).max); vm.warp(timestamp); @@ -1722,7 +1762,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setCacheDuration(duration); } - function testFuzzSetCacheDuration(uint256 duration) public { + function testFuzzSetCacheDuration( + uint256 duration + ) public { uint256 currentDuration = storageRegistry.priceFeedCacheDuration(); vm.expectEmit(false, false, false, true); @@ -1746,7 +1788,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setMaxAge(age); } - function testFuzzSetMaxAge(uint256 age) public { + function testFuzzSetMaxAge( + uint256 age + ) public { uint256 currentAge = storageRegistry.priceFeedMaxAge(); vm.expectEmit(false, false, false, true); @@ -1770,7 +1814,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setMinAnswer(answer); } - function testFuzzSetMinAnswer(uint256 answer) public { + function testFuzzSetMinAnswer( + uint256 answer + ) public { answer = bound(answer, 0, storageRegistry.priceFeedMaxAnswer() - 1); uint256 currentMin = storageRegistry.priceFeedMinAnswer(); @@ -1783,7 +1829,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(storageRegistry.priceFeedMinAnswer(), answer); } - function testFuzzCannotSetMinEqualOrAboveMax(uint256 answer) public { + function testFuzzCannotSetMinEqualOrAboveMax( + uint256 answer + ) public { answer = bound(answer, storageRegistry.priceFeedMaxAnswer(), type(uint256).max); vm.prank(owner); @@ -1799,7 +1847,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setMaxAnswer(answer); } - function testFuzzSetMaxAnswer(uint256 answer) public { + function testFuzzSetMaxAnswer( + uint256 answer + ) public { answer = bound(answer, storageRegistry.priceFeedMinAnswer() + 1, type(uint256).max); uint256 currentMax = storageRegistry.priceFeedMaxAnswer(); @@ -1812,7 +1862,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(storageRegistry.priceFeedMaxAnswer(), answer); } - function testFuzzCannotSetMaxEqualOrBelowMin(uint256 answer) public { + function testFuzzCannotSetMaxEqualOrBelowMin( + uint256 answer + ) public { answer = bound(answer, 0, storageRegistry.priceFeedMinAnswer()); vm.prank(owner); @@ -1832,7 +1884,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.setGracePeriod(duration); } - function testFuzzSetGracePeriod(uint256 duration) public { + function testFuzzSetGracePeriod( + uint256 duration + ) public { uint256 currentGracePeriod = storageRegistry.uptimeFeedGracePeriod(); vm.expectEmit(false, false, false, true); @@ -1848,7 +1902,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { SET VAULT //////////////////////////////////////////////////////////////*/ - function testFuzzSetVault(address newVault) public { + function testFuzzSetVault( + address newVault + ) public { vm.assume(newVault != address(0)); vm.expectEmit(false, false, false, true); emit SetVault(vault, newVault); @@ -1891,7 +1947,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(storageRegistry.paused(), false); } - function testFuzzOnlyOwnerCanPause(address caller) public { + function testFuzzOnlyOwnerCanPause( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -1899,7 +1957,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.pause(); } - function testFuzzOnlyOwnerCanUnpause(address caller) public { + function testFuzzOnlyOwnerCanUnpause( + address caller + ) public { vm.assume(caller != owner); vm.prank(caller); @@ -1931,7 +1991,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { assertEq(balanceChange, amount); } - function testFuzzWithdrawalRevertsInsufficientFunds(uint256 amount) public { + function testFuzzWithdrawalRevertsInsufficientFunds( + uint256 amount + ) public { // Ensure amount is >=0 and deal a smaller amount to the contract amount = bound(amount, 1, type(uint256).max); vm.deal(address(storageRegistry), amount - 1); @@ -1941,7 +2003,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.withdraw(amount); } - function testFuzzWithdrawalRevertsCallFailed(uint256 amount) public { + function testFuzzWithdrawalRevertsCallFailed( + uint256 amount + ) public { vm.deal(address(storageRegistry), amount); vm.prank(owner); @@ -1961,7 +2025,9 @@ contract StorageRegistryTest is StorageRegistryTestSuite { storageRegistry.withdraw(amount); } - function testFuzzWithdraw(uint256 amount) public { + function testFuzzWithdraw( + uint256 amount + ) public { // Deal an amount > 1 wei so we can withraw at least 1 amount = bound(amount, 2, type(uint256).max); vm.deal(address(storageRegistry), amount); diff --git a/test/Utils.sol b/test/Utils.sol index 9ad318ea..278e4e63 100644 --- a/test/Utils.sol +++ b/test/Utils.sol @@ -64,7 +64,9 @@ contract StubValidator { return isValid; } - function setIsValid(bool val) external { + function setIsValid( + bool val + ) external { isValid = val; } } @@ -92,23 +94,33 @@ contract MockChainlinkFeed is AggregatorV3Interface { description = _description; } - function setShouldRevert(bool _shouldRevert) external { + function setShouldRevert( + bool _shouldRevert + ) external { shouldRevert = _shouldRevert; } - function setStubTimeStamp(bool _stubTimeStamp) external { + function setStubTimeStamp( + bool _stubTimeStamp + ) external { stubTimeStamp = _stubTimeStamp; } - function setAnswer(int256 value) external { + function setAnswer( + int256 value + ) external { roundData.answer = value; } - function setRoundData(RoundData calldata _roundData) external { + function setRoundData( + RoundData calldata _roundData + ) external { roundData = _roundData; } - function getRoundData(uint80) external view returns (uint80, int256, uint256, uint256, uint80) { + function getRoundData( + uint80 + ) external view returns (uint80, int256, uint256, uint256, uint80) { return latestRoundData(); } @@ -125,7 +137,9 @@ contract MockChainlinkFeed is AggregatorV3Interface { } contract MockPriceFeed is MockChainlinkFeed(8, "Mock ETH/USD Price Feed") { - function setPrice(int256 _price) external { + function setPrice( + int256 _price + ) external { roundData.answer = _price; } } @@ -143,7 +157,9 @@ contract RevertOnReceive { //////////////////////////////////////////////////////////////*/ contract ERC1271WalletMock is Ownable, IERC1271 { - constructor(address owner) { + constructor( + address owner + ) { super.transferOwnership(owner); } @@ -156,11 +172,15 @@ contract ERC1271WalletMock is Ownable, IERC1271 { contract ERC1271MaliciousMockForceRevert is Ownable, IERC1271 { bool internal _forceRevert = true; - constructor(address owner) { + constructor( + address owner + ) { super.transferOwnership(owner); } - function setForceRevert(bool forceRevert) external { + function setForceRevert( + bool forceRevert + ) external { _forceRevert = forceRevert; } diff --git a/test/abstract/EIP712/EIP712.t.sol b/test/abstract/EIP712/EIP712.t.sol index 5ead1f42..48fed57c 100644 --- a/test/abstract/EIP712/EIP712.t.sol +++ b/test/abstract/EIP712/EIP712.t.sol @@ -18,7 +18,7 @@ contract EIP712Test is TestSuiteSetup { eip712 = new EIP712Example(); } - function testExposesDomainSeparator() public { + function testExposesDomainSeparator() public view { assertEq(eip712.domainSeparatorV4(), 0x0617e266f62048821cb1d443cca5b7a0e073cb89f23c9f20046cdf79ecb42429); } } diff --git a/test/abstract/Guardians/Guardians.symbolic.t.sol b/test/abstract/Guardians/Guardians.symbolic.t.sol index 0096f65f..87c4d693 100644 --- a/test/abstract/Guardians/Guardians.symbolic.t.sol +++ b/test/abstract/Guardians/Guardians.symbolic.t.sol @@ -7,7 +7,9 @@ import {Test} from "forge-std/Test.sol"; import {Guardians} from "../../../src/abstract/Guardians.sol"; contract GuardiansExample is Guardians { - constructor(address owner) Guardians(owner) {} + constructor( + address owner + ) Guardians(owner) {} } contract GuardiansSymTest is SymTest, Test { @@ -108,7 +110,9 @@ contract GuardiansSymTest is SymTest, Test { /** * @dev Generates valid calldata for a given function selector. */ - function _calldataFor(bytes4 selector) internal returns (bytes memory) { + function _calldataFor( + bytes4 selector + ) internal returns (bytes memory) { return abi.encodePacked(selector, svm.createBytes(1024, "data")); } } diff --git a/test/abstract/Migration/Migration.symbolic.t.sol b/test/abstract/Migration/Migration.symbolic.t.sol index 599e700e..628a281d 100644 --- a/test/abstract/Migration/Migration.symbolic.t.sol +++ b/test/abstract/Migration/Migration.symbolic.t.sol @@ -112,7 +112,9 @@ contract MigrationSymTest is SymTest, Test { /** * @dev Generates valid calldata for a given function selector. */ - function _calldataFor(bytes4 selector) internal returns (bytes memory) { + function _calldataFor( + bytes4 selector + ) internal returns (bytes memory) { return abi.encodePacked(selector, svm.createBytes(1024, "data")); } } diff --git a/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidator.t.sol b/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidator.t.sol index 3186443b..9fe6ced5 100644 --- a/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidator.t.sol +++ b/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidator.t.sol @@ -7,13 +7,13 @@ import {SignedKeyRequestValidatorTestSuite} from "./SignedKeyRequestValidatorTes contract SignedKeyRequestValidatorTest is SignedKeyRequestValidatorTestSuite { event SetIdRegistry(address oldIdRegistry, address newIdRegistry); - function testMetadataTypeHash() public { + function testMetadataTypeHash() public view { assertEq( validator.METADATA_TYPEHASH(), keccak256("SignedKeyRequest(uint256 requestFid,bytes key,uint256 deadline)") ); } - function testVersion() public { + function testVersion() public view { assertEq(validator.VERSION(), "2023.08.23"); } @@ -277,7 +277,7 @@ contract SignedKeyRequestValidatorTest is SignedKeyRequestValidatorTestSuite { address requestSigner, bytes calldata signature, uint256 deadline - ) public { + ) public view { SignedKeyRequestValidator.SignedKeyRequestMetadata memory request = SignedKeyRequestValidator .SignedKeyRequestMetadata({ requestFid: requestFid, @@ -308,7 +308,9 @@ contract SignedKeyRequestValidatorTest is SignedKeyRequestValidatorTestSuite { validator.setIdRegistry(idRegistry); } - function testFuzzSetIdRegistry(address idRegistry) public { + function testFuzzSetIdRegistry( + address idRegistry + ) public { address currentIdRegistry = address(validator.idRegistry()); vm.expectEmit(false, false, false, true); diff --git a/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidatorTestSuite.sol b/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidatorTestSuite.sol index 06902844..0112183c 100644 --- a/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidatorTestSuite.sol +++ b/test/validators/SignedKeyRequestValidator/SignedKeyRequestValidatorTestSuite.sol @@ -16,7 +16,9 @@ abstract contract SignedKeyRequestValidatorTestSuite is IdRegistryTestSuite { validator = new SignedKeyRequestValidator(address(idRegistry), owner); } - function _validKey(bytes memory keyBytes) internal pure returns (bytes memory) { + function _validKey( + bytes memory keyBytes + ) internal pure returns (bytes memory) { if (keyBytes.length < 32) { // pad with zero bytes bytes memory padding = new bytes(32 - keyBytes.length); @@ -32,7 +34,7 @@ abstract contract SignedKeyRequestValidatorTestSuite is IdRegistryTestSuite { } } - function _shortKey(bytes memory keyBytes, uint8 _amount) internal view returns (bytes memory) { + function _shortKey(bytes memory keyBytes, uint8 _amount) internal pure returns (bytes memory) { uint256 amount = bound(_amount, 0, 31); assembly { mstore(keyBytes, amount) @@ -40,7 +42,7 @@ abstract contract SignedKeyRequestValidatorTestSuite is IdRegistryTestSuite { return keyBytes; } - function _longKey(bytes memory keyBytes, uint8 _amount) internal view returns (bytes memory) { + function _longKey(bytes memory keyBytes, uint8 _amount) internal pure returns (bytes memory) { uint256 amount = bound(_amount, 1, type(uint8).max); bytes memory padding = new bytes(amount); return bytes.concat(_validKey(keyBytes), padding); @@ -51,7 +53,7 @@ abstract contract SignedKeyRequestValidatorTestSuite is IdRegistryTestSuite { uint256 requestingFid, bytes memory signerPubKey, uint256 deadline - ) internal returns (bytes memory signature) { + ) internal view returns (bytes memory signature) { bytes32 digest = validator.hashTypedDataV4( keccak256(abi.encode(validator.METADATA_TYPEHASH(), requestingFid, keccak256(signerPubKey), deadline)) ); From 17613f5bb473c87a68832bd0430c6a91dce3ea4c Mon Sep 17 00:00:00 2001 From: Obsidian <131651958+0xObsidian@users.noreply.github.com> Date: Fri, 27 Dec 2024 08:59:36 -0500 Subject: [PATCH 3/3] chore: updated gas snapshots Gas snapshots should reflect current changes from adding proper state mutability modifiers. --- .gas-snapshot | 445 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 440 insertions(+), 5 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 2cecb0d6..b49573be 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,8 +1,443 @@ -BundleRegistryGasUsageTest:testGasRegisterWithSig() (gas: 1118748) -IdGatewayGasUsageTest:testGasRegister() (gas: 1402640) -IdGatewayGasUsageTest:testGasRegisterForAndRecover() (gas: 1973946) +BundleRegistryGasUsageTest:testGasRegisterWithSig() (gas: 1121853) +BundlerTest:testFuzzRegister(address,uint256,address,uint256,uint8,uint40) (runs: 512, μ: 976761, ~: 857542) +BundlerTest:testFuzzRegisterReturnsExcessPayment(address,uint256,address,uint40,uint256,uint256) (runs: 512, μ: 327192, ~: 327528) +BundlerTest:testFuzzRegisterRevertsInsufficientPayment(address,uint256,address,uint40,uint256,uint256) (runs: 512, μ: 251149, ~: 251194) +BundlerTest:testFuzzRegisterZeroStorage(address,uint256,address,uint8,uint40) (runs: 512, μ: 1009712, ~: 928902) +BundlerTest:testFuzzRevertsDirectPayments(address,uint256) (runs: 512, μ: 19527, ~: 19580) +BundlerTest:testHasIDRegistry() (gas: 10479) +BundlerTest:testVersion() (gas: 9660) +EIP712Test:testExposesDomainSeparator() (gas: 8316) +FnameResolverTest:testFuzzInterfaceDetectionUnsupportedInterface(bytes4) (runs: 512, μ: 9033, ~: 9033) +FnameResolverTest:testFuzzOnlyOwnerCanAddSigner(address,address) (runs: 512, μ: 13744, ~: 13744) +FnameResolverTest:testFuzzOnlyOwnerCanRemoveSigner(address,address) (runs: 512, μ: 13691, ~: 13691) +FnameResolverTest:testFuzzOwnerCanAddSigner(address) (runs: 512, μ: 39065, ~: 39065) +FnameResolverTest:testFuzzOwnerCanRemoveSigner(address) (runs: 512, μ: 30431, ~: 30417) +FnameResolverTest:testFuzzResolveRevertsNonAddrFunction(bytes,bytes) (runs: 512, μ: 12894, ~: 12836) +FnameResolverTest:testFuzzResolveRevertsWithOffchainLookup(bytes,bytes) (runs: 512, μ: 28741, ~: 28344) +FnameResolverTest:testFuzzResolveWithProofInvalidName(string,uint256,address) (runs: 512, μ: 26548, ~: 26425) +FnameResolverTest:testFuzzResolveWithProofInvalidOwner(string,uint256,address) (runs: 512, μ: 26256, ~: 26173) +FnameResolverTest:testFuzzResolveWithProofInvalidSignerLength(string,uint256,address,bytes,uint8) (runs: 512, μ: 19515, ~: 19453) +FnameResolverTest:testFuzzResolveWithProofInvalidTimestamp(string,uint256,address) (runs: 512, μ: 26213, ~: 26130) +FnameResolverTest:testFuzzResolveWithProofValidSignature(string,uint256,address) (runs: 512, μ: 27211, ~: 27126) +FnameResolverTest:testFuzzResolveWithProofWrongSigner(string,uint256,address) (runs: 512, μ: 26173, ~: 26090) +FnameResolverTest:testInitialOwner() (gas: 12593) +FnameResolverTest:testInterfaceDetectionERC165() (gas: 8524) +FnameResolverTest:testInterfaceDetectionIExtendedResolver() (gas: 8507) +FnameResolverTest:testProofTypehash() (gas: 8383) +FnameResolverTest:testSignerIsAuthorized() (gas: 12751) +FnameResolverTest:testURL() (gas: 17032) +FnameResolverTest:testVersion() (gas: 9857) +IdGatewayGasUsageTest:testGasRegister() (gas: 1407449) +IdGatewayGasUsageTest:testGasRegisterForAndRecover() (gas: 1983534) +IdGatewayOwnerTest:testFuzzAcceptOwnership(address) (runs: 512, μ: 33890, ~: 33876) +IdGatewayOwnerTest:testFuzzCannotAcceptOwnershipUnlessPendingOwner(address,address) (runs: 512, μ: 42003, ~: 42003) +IdGatewayOwnerTest:testFuzzCannotPauseUnlessGuardian(address) (runs: 512, μ: 21665, ~: 21665) +IdGatewayOwnerTest:testFuzzCannotTransferOwnershipUnlessOwner(address,address) (runs: 512, μ: 21158, ~: 21158) +IdGatewayOwnerTest:testFuzzCannotUnpauseUnlessOwner(address) (runs: 512, μ: 43111, ~: 43111) +IdGatewayOwnerTest:testFuzzTransferOwnership(address,address) (runs: 512, μ: 48499, ~: 48499) +IdGatewayOwnerTest:testPause() (gas: 40770) +IdGatewayOwnerTest:testUnpause() (gas: 29464) +IdGatewayTest:testFuzzCannotRegisterForIfPaused(address,uint256,address,uint40) (runs: 512, μ: 70124, ~: 70107) +IdGatewayTest:testFuzzCannotRegisterForToAnAddressThatOwnsAnId(address,uint256,address,uint40) (runs: 512, μ: 140706, ~: 140689) +IdGatewayTest:testFuzzCannotRegisterIfPaused(address,address) (runs: 512, μ: 58814, ~: 58814) +IdGatewayTest:testFuzzCannotRegisterToAnAddressThatOwnsAnId(address,address) (runs: 512, μ: 130554, ~: 130554) +IdGatewayTest:testFuzzOnlyOwnerCanSetStorageRegistry(address,address) (runs: 512, μ: 17948, ~: 17948) +IdGatewayTest:testFuzzRegister(address,address) (runs: 512, μ: 192291, ~: 192408) +IdGatewayTest:testFuzzRegisterExtraStorage(address,address,uint16) (runs: 512, μ: 192645, ~: 192762) +IdGatewayTest:testFuzzRegisterFor(address,uint256,address,uint40) (runs: 512, μ: 228269, ~: 228408) +IdGatewayTest:testFuzzRegisterForERC1271(address,uint256,address,uint40) (runs: 512, μ: 720380, ~: 720519) +IdGatewayTest:testFuzzRegisterForExtraStorage(address,uint256,address,uint40,uint16) (runs: 512, μ: 228652, ~: 228746) +IdGatewayTest:testFuzzRegisterForRevertsBadSig(address,uint256,address,uint40) (runs: 512, μ: 67724, ~: 67707) +IdGatewayTest:testFuzzRegisterForRevertsExpiredSig(address,uint256,address,uint40) (runs: 512, μ: 64745, ~: 64728) +IdGatewayTest:testFuzzRegisterForRevertsInvalidSig(address,uint256,address,uint40) (runs: 512, μ: 72145, ~: 72128) +IdGatewayTest:testFuzzRegisterForRevertsMaliciousERC1271(address,uint256,address,uint40) (runs: 512, μ: 598066, ~: 598049) +IdGatewayTest:testFuzzRegisterForRevertsUsedNonce(address,uint256,address,uint40) (runs: 512, μ: 73402, ~: 73385) +IdGatewayTest:testFuzzRegisterReturnsOverpayment(address,address,uint32) (runs: 512, μ: 230095, ~: 232039) +IdGatewayTest:testFuzzRevertsDirectPayments(address,uint256) (runs: 512, μ: 24058, ~: 24111) +IdGatewayTest:testFuzzSetStorageRegistry(address) (runs: 512, μ: 24474, ~: 24474) +IdGatewayTest:testIdRegistry() (gas: 10512) +IdGatewayTest:testRegisterTypehash() (gas: 8382) +IdGatewayTest:testStorageRegistry() (gas: 12643) +IdGatewayTest:testVersion() (gas: 9767) +IdRegistryOwnerTest:testAddRemoveGuardian(address) (runs: 512, μ: 33031, ~: 33017) +IdRegistryOwnerTest:testCannotAddGuardianUnlessOwner(address,address) (runs: 512, μ: 18840, ~: 18840) +IdRegistryOwnerTest:testCannotRemoveGuardianUnlessOwner(address,address) (runs: 512, μ: 18840, ~: 18840) +IdRegistryOwnerTest:testFuzzAcceptOwnership(address) (runs: 512, μ: 33927, ~: 33912) +IdRegistryOwnerTest:testFuzzCannotAcceptOwnershipUnlessPendingOwner(address,address) (runs: 512, μ: 42071, ~: 42071) +IdRegistryOwnerTest:testFuzzCannotPauseUnlessGuardian(address) (runs: 512, μ: 21734, ~: 21734) +IdRegistryOwnerTest:testFuzzCannotTransferOwnershipUnlessOwner(address,address) (runs: 512, μ: 21206, ~: 21206) +IdRegistryOwnerTest:testFuzzCannotUnpauseUnlessOwner(address) (runs: 512, μ: 42327, ~: 42327) +IdRegistryOwnerTest:testFuzzTransferOwnership(address,address) (runs: 512, μ: 48615, ~: 48615) +IdRegistryOwnerTest:testPause() (gas: 40008) +IdRegistryOwnerTest:testUnpause() (gas: 28888) +IdRegistryTest:testBulkRegisterCannotReRegister() (gas: 231216) +IdRegistryTest:testBulkRegisterEmitsEvent() (gas: 235228) +IdRegistryTest:testBulkRegisterUnpausedReverts() (gas: 25513) +IdRegistryTest:testBulkRegisterWithRecoveryCannotReRegister(address) (runs: 512, μ: 229488, ~: 229722) +IdRegistryTest:testBulkRegisterWithRecoveryEmitsEvent(address) (runs: 512, μ: 233364, ~: 233598) +IdRegistryTest:testBulkRegisterWithRecoveryUnpausedReverts(address) (runs: 512, μ: 24407, ~: 24407) +IdRegistryTest:testBulkResetEmitsEvent() (gas: 189812) +IdRegistryTest:testFreezeIdGatewayRevertsWhenFrozen() (gas: 39267) +IdRegistryTest:testFuzzBulkRegisterAfterGracePeriodRevertsUnauthorized(uint40) (runs: 512, μ: 30637, ~: 30593) +IdRegistryTest:testFuzzBulkRegisterDuringGracePeriod(uint40) (runs: 512, μ: 97987, ~: 97693) +IdRegistryTest:testFuzzBulkRegisterIds(uint24[],uint128,uint128) (runs: 512, μ: 3405957, ~: 3043621) +IdRegistryTest:testFuzzBulkRegisterIdsWithRecovery(uint24[],uint128,address) (runs: 512, μ: 3449062, ~: 3116312) +IdRegistryTest:testFuzzBulkRegisterWithRecoveryAfterGracePeriodRevertsUnauthorized(uint40,address) (runs: 512, μ: 30472, ~: 30437) +IdRegistryTest:testFuzzBulkRegisterWithRecoveryDuringGracePeriod(uint40,address) (runs: 512, μ: 97538, ~: 97318) +IdRegistryTest:testFuzzBulkResetAfterGracePeriodRevertsUnauthorized(uint40) (runs: 512, μ: 29606, ~: 29562) +IdRegistryTest:testFuzzBulkResetDuringGracePeriod(uint40) (runs: 512, μ: 195448, ~: 195217) +IdRegistryTest:testFuzzBulkResetIds(uint24[]) (runs: 512, μ: 3115040, ~: 2704644) +IdRegistryTest:testFuzzBulkResetUnpausedReverts() (gas: 20842) +IdRegistryTest:testFuzzCannotChangeRecoveryAddressForWhenPaused(address,uint256,address,address,uint40) (runs: 512, μ: 147574, ~: 147701) +IdRegistryTest:testFuzzCannotChangeRecoveryAddressForWithoutId(address,uint256,address,address,uint40) (runs: 512, μ: 26206, ~: 26177) +IdRegistryTest:testFuzzCannotChangeRecoveryAddressWhenPaused(address,address,address) (runs: 512, μ: 136698, ~: 136854) +IdRegistryTest:testFuzzCannotChangeRecoveryAddressWithoutId(address,address) (runs: 512, μ: 13822, ~: 13822) +IdRegistryTest:testFuzzCannotMigrateTwice(uint40) (runs: 512, μ: 28339, ~: 28327) +IdRegistryTest:testFuzzCannotRecoverForFromAddressWithNoId(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 46744, ~: 46709) +IdRegistryTest:testFuzzCannotRecoverForToAddressWithId(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 196182, ~: 196341) +IdRegistryTest:testFuzzCannotRecoverToAddressThatOwnsAnId(address,uint256,uint40,address) (runs: 512, μ: 189140, ~: 189281) +IdRegistryTest:testFuzzCannotRecoverUnlessRecoveryAddress(address,uint256,uint40,address,address) (runs: 512, μ: 133897, ~: 134072) +IdRegistryTest:testFuzzCannotRecoverWhenPaused(address,uint256,uint40,address) (runs: 512, μ: 188616, ~: 188757) +IdRegistryTest:testFuzzCannotRecoverWithoutId(address,uint256,uint40,address) (runs: 512, μ: 36939, ~: 36924) +IdRegistryTest:testFuzzCannotRegisterIfPaused(address,address) (runs: 512, μ: 64013, ~: 64013) +IdRegistryTest:testFuzzCannotRegisterToAnAddressThatOwnsAnId(address,address) (runs: 512, μ: 101588, ~: 101666) +IdRegistryTest:testFuzzCannotTransferAndChangeRecoveryForToAddressWithId(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 173396, ~: 173361) +IdRegistryTest:testFuzzCannotTransferAndChangeRecoveryIfNoId(address,address,uint256,uint40) (runs: 512, μ: 46157, ~: 46144) +IdRegistryTest:testFuzzCannotTransferAndChangeRecoveryWhenPaused(address,address,uint256,uint40) (runs: 512, μ: 169460, ~: 169486) +IdRegistryTest:testFuzzCannotTransferAndChangeToAddressWithId(address,uint256,uint40,address,address) (runs: 512, μ: 205448, ~: 205701) +IdRegistryTest:testFuzzCannotTransferForFromAddressWithNoId(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 51968, ~: 51933) +IdRegistryTest:testFuzzCannotTransferForFromAddressWithNoId(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 51749, ~: 51710) +IdRegistryTest:testFuzzCannotTransferForToAddressWithId(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 173042, ~: 173003) +IdRegistryTest:testFuzzCannotTransferIfNoId(address,uint256,uint40) (runs: 512, μ: 40904, ~: 40885) +IdRegistryTest:testFuzzCannotTransferToAddressWithId(address,uint256,uint40,address) (runs: 512, μ: 202227, ~: 202368) +IdRegistryTest:testFuzzCannotTransferWhenPaused(address,uint256,uint40) (runs: 512, μ: 166107, ~: 166127) +IdRegistryTest:testFuzzCannotVerifyFidSignatureERC1271IfBadCustodyAddress(uint256,bytes32) (runs: 512, μ: 576002, ~: 575988) +IdRegistryTest:testFuzzCannotVerifyFidSignatureERC1271IfBadDigest(uint256,bytes32,bytes32) (runs: 512, μ: 588582, ~: 588565) +IdRegistryTest:testFuzzCannotVerifyFidSignatureERC1271IfMalicious(uint256,bytes32) (runs: 512, μ: 627462, ~: 627448) +IdRegistryTest:testFuzzCannotVerifyFidSignatureIfBadCustodyAddress(uint256,bytes32,address) (runs: 512, μ: 96055, ~: 96034) +IdRegistryTest:testFuzzCannotVerifyFidSignatureIfBadDigest(uint256,bytes32,bytes32) (runs: 512, μ: 101910, ~: 101893) +IdRegistryTest:testFuzzCannotVerifyFidSignatureIfBadFid(uint256,bytes32) (runs: 512, μ: 93550, ~: 93536) +IdRegistryTest:testFuzzChangeRecoveryAddress(address,address,address) (runs: 512, μ: 111882, ~: 111999) +IdRegistryTest:testFuzzChangeRecoveryAddressFor(address,uint256,address,address,uint40) (runs: 512, μ: 149546, ~: 149634) +IdRegistryTest:testFuzzChangeRecoveryAddressForRevertsBadSig(address,uint256,address,address,uint40) (runs: 512, μ: 145419, ~: 145546) +IdRegistryTest:testFuzzChangeRecoveryAddressForRevertsExpired(address,uint256,address,address,uint40) (runs: 512, μ: 142605, ~: 142732) +IdRegistryTest:testFuzzChangeRecoveryAddressForRevertsInvalidSig(address,uint256,address,address,uint40) (runs: 512, μ: 150039, ~: 150166) +IdRegistryTest:testFuzzChangeRecoveryAddressForRevertsUsedNonce(address,uint256,address,address,uint40) (runs: 512, μ: 151392, ~: 151519) +IdRegistryTest:testFuzzFreezeIdGateway(address) (runs: 512, μ: 43625, ~: 43625) +IdRegistryTest:testFuzzMigration(uint40) (runs: 512, μ: 24041, ~: 24041) +IdRegistryTest:testFuzzOnlyMigratorCanMigrate(address) (runs: 512, μ: 18041, ~: 18041) +IdRegistryTest:testFuzzOnlyOwnerCanFreezeIdGateway(address) (runs: 512, μ: 13578, ~: 13578) +IdRegistryTest:testFuzzOnlyOwnerCanSetIdGateway(address,address) (runs: 512, μ: 13836, ~: 13836) +IdRegistryTest:testFuzzOwnerCanSetMigrator(address) (runs: 512, μ: 25513, ~: 25532) +IdRegistryTest:testFuzzRecover(address,uint256,uint40,address) (runs: 512, μ: 167354, ~: 167339) +IdRegistryTest:testFuzzRecoverFor(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 204495, ~: 204460) +IdRegistryTest:testFuzzRecoverForForRevertsInvalidToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 196908, ~: 197067) +IdRegistryTest:testFuzzRecoverForForRevertsUsedRecoveryNonce(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 173435, ~: 173594) +IdRegistryTest:testFuzzRecoverForForRevertsUsedToNonce(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 198235, ~: 198394) +IdRegistryTest:testFuzzRecoverForRevertsInvalidRecoverySig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 172093, ~: 172252) +IdRegistryTest:testFuzzRecoverForRevertsWhenPaused(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 221763, ~: 221922) +IdRegistryTest:testFuzzRecoverRevertsBadSig(address,uint256,uint40,address) (runs: 512, μ: 157316, ~: 157457) +IdRegistryTest:testFuzzRecoverRevertsExpiredSig(address,uint256,uint40,address) (runs: 512, μ: 154468, ~: 154609) +IdRegistryTest:testFuzzRecoverRevertsInvalidSig(address,uint256,uint40,address) (runs: 512, μ: 161931, ~: 162072) +IdRegistryTest:testFuzzRegister(address,address) (runs: 512, μ: 119394, ~: 119550) +IdRegistryTest:testFuzzRegisterRevertsUnauthorized(address,address,address) (runs: 512, μ: 36432, ~: 36432) +IdRegistryTest:testFuzzSetIdCounter(uint256) (runs: 512, μ: 41925, ~: 42159) +IdRegistryTest:testFuzzSetIdCounterAfterGracePeriodReverts(uint256,uint40) (runs: 512, μ: 33092, ~: 33060) +IdRegistryTest:testFuzzSetIdCounterDuringGracePeriod(uint256,uint40) (runs: 512, μ: 54088, ~: 54001) +IdRegistryTest:testFuzzSetIdCounterUnpausedReverts(uint256) (runs: 512, μ: 24257, ~: 24257) +IdRegistryTest:testFuzzSetIdGateway(address) (runs: 512, μ: 40697, ~: 40697) +IdRegistryTest:testFuzzSetIdGatewayRevertsWhenFrozen(address) (runs: 512, μ: 40882, ~: 40882) +IdRegistryTest:testFuzzSetMigratorRevertsWhenMigrated(address) (runs: 512, μ: 25265, ~: 25265) +IdRegistryTest:testFuzzSetMigratorRevertsWhenUnpaused(address) (runs: 512, μ: 20440, ~: 20440) +IdRegistryTest:testFuzzTransfer(address,uint256,uint40) (runs: 512, μ: 142510, ~: 142491) +IdRegistryTest:testFuzzTransferAndChangeRecovery(address,address,uint256,uint40) (runs: 512, μ: 169443, ~: 169624) +IdRegistryTest:testFuzzTransferAndChangeRecoveryFor(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 204266, ~: 204425) +IdRegistryTest:testFuzzTransferAndChangeRecoveryForRevertsBadToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 175368, ~: 175333) +IdRegistryTest:testFuzzTransferAndChangeRecoveryForRevertsExpiredFromSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 147830, ~: 147795) +IdRegistryTest:testFuzzTransferAndChangeRecoveryForRevertsExpiredToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 159992, ~: 148316) +IdRegistryTest:testFuzzTransferAndChangeRecoveryForRevertsInvalidFromSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 155192, ~: 155157) +IdRegistryTest:testFuzzTransferAndChangeRecoveryForRevertsWhenPaused(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 202988, ~: 202953) +IdRegistryTest:testFuzzTransferAndChangeRecoveryRevertsBadSig(address,address,uint256,uint40) (runs: 512, μ: 140532, ~: 140558) +IdRegistryTest:testFuzzTransferAndChangeRecoveryRevertsExpiredSig(address,address,uint256,uint40) (runs: 512, μ: 137454, ~: 137480) +IdRegistryTest:testFuzzTransferAndChangeRecoveryRevertsInvalidSig(address,address,uint256,uint40) (runs: 512, μ: 145094, ~: 145120) +IdRegistryTest:testFuzzTransferAndChangeRecoverySetsRecovery(address,uint256[10],uint40,address,address[10]) (runs: 512, μ: 731121, ~: 731603) +IdRegistryTest:testFuzzTransferDoesntResetRecovery(address,uint256,uint40,address) (runs: 512, μ: 165383, ~: 165368) +IdRegistryTest:testFuzzTransferFor(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 179868, ~: 179829) +IdRegistryTest:testFuzzTransferForRevertsBadFromSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 150602, ~: 150567) +IdRegistryTest:testFuzzTransferForRevertsBadFromSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 147286, ~: 147247) +IdRegistryTest:testFuzzTransferForRevertsBadRecoverySig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 167612, ~: 167771) +IdRegistryTest:testFuzzTransferForRevertsBadToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 192308, ~: 192467) +IdRegistryTest:testFuzzTransferForRevertsBadToSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 172046, ~: 172007) +IdRegistryTest:testFuzzTransferForRevertsExpiredFromSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 144465, ~: 144426) +IdRegistryTest:testFuzzTransferForRevertsExpiredRecoverySig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 164756, ~: 164915) +IdRegistryTest:testFuzzTransferForRevertsExpiredToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 176935, ~: 165478) +IdRegistryTest:testFuzzTransferForRevertsExpiredToSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 157348, ~: 169150) +IdRegistryTest:testFuzzTransferForRevertsInvalidFromSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 151810, ~: 151771) +IdRegistryTest:testFuzzTransferForRevertsInvalidToSig(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 179968, ~: 179933) +IdRegistryTest:testFuzzTransferForRevertsInvalidToSig(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 176602, ~: 176563) +IdRegistryTest:testFuzzTransferForRevertsUsedFromNonce(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 156541, ~: 156506) +IdRegistryTest:testFuzzTransferForRevertsUsedFromNonce(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 153130, ~: 153091) +IdRegistryTest:testFuzzTransferForRevertsUsedToNonce(address,uint256,uint256,address,uint40,uint40) (runs: 512, μ: 181347, ~: 181312) +IdRegistryTest:testFuzzTransferForRevertsUsedToNonce(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 177951, ~: 177912) +IdRegistryTest:testFuzzTransferForRevertsWhenPaused(address,uint256,uint256,uint40,uint40) (runs: 512, μ: 199528, ~: 199489) +IdRegistryTest:testFuzzTransferReregister(address,uint256,uint40) (runs: 512, μ: 195308, ~: 195328) +IdRegistryTest:testFuzzTransferRevertsBadSig(address,uint256,uint40) (runs: 512, μ: 137189, ~: 137209) +IdRegistryTest:testFuzzTransferRevertsExpiredSig(address,uint256,uint40) (runs: 512, μ: 134306, ~: 134326) +IdRegistryTest:testFuzzTransferRevertsInvalidSig(address,uint256,uint40) (runs: 512, μ: 141806, ~: 141826) +IdRegistryTest:testFuzzVerifyFidSignature(uint256,bytes32) (runs: 512, μ: 97450, ~: 97436) +IdRegistryTest:testFuzzVerifyFidSignatureERC1271(uint256,bytes32) (runs: 512, μ: 584222, ~: 584208) +IdRegistryTest:testInitialGracePeriod() (gas: 8451) +IdRegistryTest:testInitialMigrationTimestamp() (gas: 10551) +IdRegistryTest:testInitialMigrator() (gas: 12633) +IdRegistryTest:testInitialStateIsNotMigrated() (gas: 10549) +IdRegistryTest:testName() (gas: 9805) +IdRegistryTest:testTransferAndChangeRecoveryTypehash() (gas: 8361) +IdRegistryTest:testTransferTypehash() (gas: 8408) +IdRegistryTest:testVersion() (gas: 9823) +KeyGatewayTest:testFuzzAdd(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 316921, ~: 306189) +KeyGatewayTest:testFuzzAddFor(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 349373, ~: 338216) +KeyGatewayTest:testFuzzAddForRevertsBadSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 207967, ~: 208027) +KeyGatewayTest:testFuzzAddForRevertsExpiredSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 166630, ~: 166610) +KeyGatewayTest:testFuzzAddForRevertsInvalidSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 212594, ~: 212654) +KeyGatewayTest:testFuzzAddForRevertsNoFid(address,uint256,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 108955, ~: 108877) +KeyGatewayTest:testFuzzAddForRevertsPaused(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 171108, ~: 171091) +KeyGatewayTest:testFuzzAddForRevertsUsedNonce(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 213863, ~: 213924) +KeyGatewayTest:testFuzzAddRevertsIfRemoved(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 338278, ~: 321747) +KeyGatewayTest:testFuzzAddRevertsIfStateNotNull(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 314334, ~: 303922) +KeyGatewayTest:testFuzzAddRevertsInvalidMetadata(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 312752, ~: 302398) +KeyGatewayTest:testFuzzAddRevertsMaxKeys(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 1586989, ~: 1440625) +KeyGatewayTest:testFuzzAddRevertsPaused(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 186156, ~: 186340) +KeyGatewayTest:testFuzzAddRevertsUnlessFidOwner(address,address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 184656, ~: 184771) +KeyGatewayTest:testFuzzAddRevertsUnregisteredValidator(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 156728, ~: 156942) +KeyGatewayTest:testFuzzOnlyAuthorizedCanPause(address) (runs: 512, μ: 15579, ~: 15579) +KeyGatewayTest:testFuzzOnlyOwnerCanUnpause(address) (runs: 512, μ: 13474, ~: 13474) +KeyGatewayTest:testFuzzPauseUnpauseGuardian(address) (runs: 512, μ: 48943, ~: 48929) +KeyGatewayTest:testFuzzPauseUnpauseOwner() (gas: 28690) +KeyGatewayTest:testVersion() (gas: 9793) +KeyRegistryIntegrationTest:testFuzzAdd(address,uint256,address,bytes,uint40) (runs: 512, μ: 334780, ~: 335131) +KeyRegistryIntegrationTest:testFuzzAddRevertsInvalidSig(address,uint256,uint256,address,bytes,uint40) (runs: 512, μ: 331563, ~: 327541) +KeyRegistryIntegrationTest:testFuzzAddRevertsLongKey(address,uint256,address,bytes,uint40,uint8) (runs: 512, μ: 325864, ~: 322984) +KeyRegistryIntegrationTest:testFuzzAddRevertsShortKey(address,uint256,address,bytes,uint40,uint8) (runs: 512, μ: 291915, ~: 295260) +KeyRegistryTest:testBulkAddCannotReAdd() (gas: 259467) +KeyRegistryTest:testBulkAddEmitsEvent() (gas: 446599) +KeyRegistryTest:testBulkAddRevertsWhenUnpaused() (gas: 59152) +KeyRegistryTest:testBulkResetEmitsEvent() (gas: 376723) +KeyRegistryTest:testBulkResetRevertsIfRunTwice() (gas: 216468) +KeyRegistryTest:testBulkResetRevertsWithoutAdding() (gas: 60472) +KeyRegistryTest:testFreezeKeyGatewayRevertsWhenFrozen() (gas: 37850) +KeyRegistryTest:testFuzzAdd(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 309117, ~: 298196) +KeyRegistryTest:testFuzzAddRevertsIfRemoved(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 331060, ~: 313664) +KeyRegistryTest:testFuzzAddRevertsIfStateNotNull(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 305273, ~: 294678) +KeyRegistryTest:testFuzzAddRevertsInvalidMetadata(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 305512, ~: 294969) +KeyRegistryTest:testFuzzAddRevertsMaxKeys(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 1570149, ~: 1423623) +KeyRegistryTest:testFuzzAddRevertsPaused(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 183045, ~: 183035) +KeyRegistryTest:testFuzzAddRevertsUnlessRegistration(address,address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 172232, ~: 172304) +KeyRegistryTest:testFuzzAddRevertsUnregisteredValidator(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 146985, ~: 147001) +KeyRegistryTest:testFuzzBulkAddKeyForMigrationDuringGracePeriod(uint40) (runs: 512, μ: 166202, ~: 165934) +KeyRegistryTest:testFuzzBulkAddSignerForMigration(uint256[],uint8) (runs: 512, μ: 23105654, ~: 14304195) +KeyRegistryTest:testFuzzBulkAddSignerForMigrationAfterGracePeriodRevertsUnauthorized(uint40) (runs: 512, μ: 31593, ~: 31555) +KeyRegistryTest:testFuzzBulkRemoveSignerForMigration(uint256[],uint8) (runs: 512, μ: 21676863, ~: 13611882) +KeyRegistryTest:testFuzzBulkRemoveSignerForMigrationAfterGracePeriodRevertsUnauthorized(uint40) (runs: 512, μ: 31077, ~: 31039) +KeyRegistryTest:testFuzzBulkRemoveSignerForMigrationDuringGracePeriod(uint40) (runs: 512, μ: 136366, ~: 136156) +KeyRegistryTest:testFuzzBulkRemoveSignerForMigrationRevertsWhenUnpaused() (gas: 22338) +KeyRegistryTest:testFuzzCannotMigrateTwice(uint40) (runs: 512, μ: 28317, ~: 28305) +KeyRegistryTest:testFuzzKeyAt(address,address,uint32,uint8,uint16) (runs: 512, μ: 5659131, ~: 5040329) +KeyRegistryTest:testFuzzKeyCounts(address,address,uint32,uint8,uint16,uint16) (runs: 512, μ: 4446214, ~: 3743065) +KeyRegistryTest:testFuzzKeyHelpersRevertInvalidState() (gas: 22046) +KeyRegistryTest:testFuzzKeysOf(address,address,uint32,uint8,uint16) (runs: 512, μ: 5595273, ~: 4983802) +KeyRegistryTest:testFuzzKeysOfPaged(address,address,bool,uint32,uint8) (runs: 512, μ: 3346258, ~: 2812048) +KeyRegistryTest:testFuzzKeysOfPagedIndexEqualToLength(address,address,uint32,uint8) (runs: 512, μ: 2555159, ~: 2555229) +KeyRegistryTest:testFuzzKeysOfPagedIndexGreaterThanLength(address,address,uint32,uint8) (runs: 512, μ: 2555158, ~: 2555228) +KeyRegistryTest:testFuzzKeysOfPagedNeverReverts(address,address,uint32,uint8,uint256,uint256) (runs: 512, μ: 2555467, ~: 2554472) +KeyRegistryTest:testFuzzMigration(uint40) (runs: 512, μ: 24019, ~: 24019) +KeyRegistryTest:testFuzzOnlyAdminCanPause(address) (runs: 512, μ: 15625, ~: 15625) +KeyRegistryTest:testFuzzOnlyAdminCanSetIdRegistry(address,address) (runs: 512, μ: 13767, ~: 13767) +KeyRegistryTest:testFuzzOnlyAdminCanSetKeyGateway(address,address) (runs: 512, μ: 13768, ~: 13768) +KeyRegistryTest:testFuzzOnlyAdminCanSetMaxKeysPerFid(address,uint256) (runs: 512, μ: 13610, ~: 13610) +KeyRegistryTest:testFuzzOnlyAdminCanSetValidator(address,uint32,uint8,address) (runs: 512, μ: 18558, ~: 18518) +KeyRegistryTest:testFuzzOnlyMigratorCanMigrate(address) (runs: 512, μ: 18040, ~: 18040) +KeyRegistryTest:testFuzzOwnerCanSetMigrator(address) (runs: 512, μ: 25479, ~: 25498) +KeyRegistryTest:testFuzzRemove(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 353380, ~: 337427) +KeyRegistryTest:testFuzzRemoveFor(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 386357, ~: 372147) +KeyRegistryTest:testFuzzRemoveForRevertsBadSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 342730, ~: 331914) +KeyRegistryTest:testFuzzRemoveForRevertsExpiredSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 339672, ~: 328848) +KeyRegistryTest:testFuzzRemoveForRevertsInvalidSig(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 347040, ~: 336216) +KeyRegistryTest:testFuzzRemoveForRevertsNoFid(address,uint256,bytes,uint40) (runs: 512, μ: 56504, ~: 56467) +KeyRegistryTest:testFuzzRemoveForRevertsUsedNonce(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 348403, ~: 337579) +KeyRegistryTest:testFuzzRemoveForRevertsWhenPaused(address,uint256,address,uint32,bytes,uint8,bytes,uint40) (runs: 512, μ: 340908, ~: 330090) +KeyRegistryTest:testFuzzRemoveRevertsIfNull(address,address,bytes) (runs: 512, μ: 130379, ~: 130498) +KeyRegistryTest:testFuzzRemoveRevertsIfRemoved(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 329284, ~: 311763) +KeyRegistryTest:testFuzzRemoveRevertsUnlessFidOwner(address,address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 305325, ~: 295647) +KeyRegistryTest:testFuzzRemoveRevertsWhenPaused(address,address,uint32,bytes,uint8,bytes) (runs: 512, μ: 348729, ~: 333001) +KeyRegistryTest:testFuzzSetIdRegistry(address) (runs: 512, μ: 23281, ~: 23291) +KeyRegistryTest:testFuzzSetKeyGateway(address) (runs: 512, μ: 40483, ~: 40522) +KeyRegistryTest:testFuzzSetKeyGatewayRevertsWhenFrozen(address) (runs: 512, μ: 40327, ~: 40327) +KeyRegistryTest:testFuzzSetMaxKeysPerFid(uint256) (runs: 512, μ: 26523, ~: 26513) +KeyRegistryTest:testFuzzSetMaxKeysPerFidRevertsLessThanOrEqualToCurrentMax(uint256) (runs: 512, μ: 21468, ~: 21506) +KeyRegistryTest:testFuzzSetMigratorRevertsWhenMigrated(address) (runs: 512, μ: 25185, ~: 25185) +KeyRegistryTest:testFuzzSetMigratorRevertsWhenUnpaused(address) (runs: 512, μ: 20448, ~: 20448) +KeyRegistryTest:testFuzzSetValidator(uint32,uint8,address) (runs: 512, μ: 47655, ~: 47800) +KeyRegistryTest:testFuzzSetValidatorRevertsZeroKeyType(uint8,address) (runs: 512, μ: 17045, ~: 17011) +KeyRegistryTest:testFuzzSetValidatorRevertsZeroMetadataType(uint32,address) (runs: 512, μ: 17061, ~: 17051) +KeyRegistryTest:testInitialGracePeriod() (gas: 8476) +KeyRegistryTest:testInitialIdRegistry() (gas: 12678) +KeyRegistryTest:testInitialMigrationTimestamp() (gas: 10559) +KeyRegistryTest:testInitialMigrator() (gas: 12624) +KeyRegistryTest:testInitialOwner() (gas: 12671) +KeyRegistryTest:testInitialStateIsNotMigrated() (gas: 10561) +KeyRegistryTest:testOnlyOwnerCanFreezeKeyGateway(address) (runs: 512, μ: 13517, ~: 13517) +KeyRegistryTest:testPauseUnpause() (gas: 29914) +KeyRegistryTest:testRemoveTypeHash() (gas: 8427) +KeyRegistryTest:testVersion() (gas: 9921) +RecoveryProxyTest:testFuzzChangeOwner(address,uint256,uint40,address) (runs: 512, μ: 186069, ~: 186092) +RecoveryProxyTest:testFuzzOnlyOwnerCanSetIdRegistry(address,address) (runs: 512, μ: 13599, ~: 13599) +RecoveryProxyTest:testFuzzRecoveryByProxy(address,uint256,uint40) (runs: 512, μ: 171750, ~: 171731) +RecoveryProxyTest:testFuzzRecoveryByProxyRevertsUnauthorized(address,uint256,uint40,address) (runs: 512, μ: 138966, ~: 139184) +RecoveryProxyTest:testFuzzSetIdRegistry(address) (runs: 512, μ: 22966, ~: 22995) +RecoveryProxyTest:testIdRegistry() (gas: 12552) +RecoveryProxyTest:testInitialOwner() (gas: 12590) +SignedKeyRequestValidatorTest:testFuzzEncodeDecodeMetadata(uint256,address,bytes,uint256) (runs: 512, μ: 14359, ~: 14170) +SignedKeyRequestValidatorTest:testFuzzOnlyAdminCanSetIdRegistry(address,address) (runs: 512, μ: 13650, ~: 13650) +SignedKeyRequestValidatorTest:testFuzzSetIdRegistry(address) (runs: 512, μ: 23053, ~: 23072) +SignedKeyRequestValidatorTest:testFuzzValidate(uint256,uint256,bytes,uint40) (runs: 512, μ: 112225, ~: 112069) +SignedKeyRequestValidatorTest:testFuzzValidateBadSig(uint256,uint256,bytes,uint40) (runs: 512, μ: 113236, ~: 113079) +SignedKeyRequestValidatorTest:testFuzzValidateExpired(uint256,uint256,bytes,uint256,uint40) (runs: 512, μ: 106492, ~: 106348) +SignedKeyRequestValidatorTest:testFuzzValidateLongKey(uint256,uint256,bytes,uint40,uint8) (runs: 512, μ: 107847, ~: 107703) +SignedKeyRequestValidatorTest:testFuzzValidateShortKey(uint256,uint256,bytes,uint40,uint8) (runs: 512, μ: 106889, ~: 106586) +SignedKeyRequestValidatorTest:testFuzzValidateUnownedAppFid(uint256,uint256,bytes,uint40) (runs: 512, μ: 105763, ~: 105607) +SignedKeyRequestValidatorTest:testFuzzValidateWrongPubKey(uint256,uint256,bytes,bytes,uint40) (runs: 512, μ: 117248, ~: 117099) +SignedKeyRequestValidatorTest:testFuzzValidateWrongSigner(uint256,uint256,bytes,address,uint40) (runs: 512, μ: 108101, ~: 107960) +SignedKeyRequestValidatorTest:testMetadataTypeHash() (gas: 8362) +SignedKeyRequestValidatorTest:testVersion() (gas: 9760) StorageRegistryGasUsageTest:testGasBatchCredit() (gas: 173053) -StorageRegistryGasUsageTest:testGasBatchRent() (gas: 270579) +StorageRegistryGasUsageTest:testGasBatchRent() (gas: 270570) StorageRegistryGasUsageTest:testGasContinuousCredit() (gas: 166530) StorageRegistryGasUsageTest:testGasCredit() (gas: 81890) -StorageRegistryGasUsageTest:testGasRent() (gas: 163250) \ No newline at end of file +StorageRegistryGasUsageTest:testGasRent() (gas: 163250) +StorageRegistryTest:testBatchRentCheckedMath() (gas: 29517) +StorageRegistryTest:testContinuousCreditAmounts() (gas: 2031064) +StorageRegistryTest:testContinuousCreditEvents() (gas: 89891021) +StorageRegistryTest:testDefaultAdmin() (gas: 13676) +StorageRegistryTest:testDeprecationTimestampDefault() (gas: 10580) +StorageRegistryTest:testEthUSDPriceDefault() (gas: 10530) +StorageRegistryTest:testFuzzBatchCredit(uint256[],uint32) (runs: 512, μ: 607956, ~: 586363) +StorageRegistryTest:testFuzzBatchCreditRevertsExceedsCapacity(uint256[],uint32) (runs: 512, μ: 74714, ~: 74716) +StorageRegistryTest:testFuzzBatchCreditRevertsIfDeprecated(uint256[],uint32) (runs: 512, μ: 21701, ~: 21703) +StorageRegistryTest:testFuzzBatchCreditRevertsIfPaused(uint256[],uint32) (runs: 512, μ: 32292, ~: 32294) +StorageRegistryTest:testFuzzBatchCreditRevertsZeroAmount(uint256[]) (runs: 512, μ: 18961, ~: 18952) +StorageRegistryTest:testFuzzBatchRent(address,uint256[],uint16[]) (runs: 512, μ: 530632, ~: 477990) +StorageRegistryTest:testFuzzBatchRentCachedPrice(address,uint256[],uint16[],int256,uint256) (runs: 512, μ: 991930, ~: 889554) +StorageRegistryTest:testFuzzBatchRentFailedRefundRevertsCallFailed(uint256[],uint16[],uint256) (runs: 512, μ: 348319, ~: 327193) +StorageRegistryTest:testFuzzBatchRentPriceRefresh(address,uint256[],uint16[],int256) (runs: 512, μ: 1008392, ~: 880859) +StorageRegistryTest:testFuzzBatchRentRefundsExcessPayment(uint256[],uint16[],uint256) (runs: 512, μ: 345691, ~: 324565) +StorageRegistryTest:testFuzzBatchRentRevertsEmptyArray(address,uint256[],uint256[],uint256) (runs: 512, μ: 49407, ~: 47849) +StorageRegistryTest:testFuzzBatchRentRevertsExceedsCapacity(address,uint256[],uint16[]) (runs: 512, μ: 335193, ~: 306097) +StorageRegistryTest:testFuzzBatchRentRevertsIfDeprecated(address,uint256[],uint16[]) (runs: 512, μ: 138985, ~: 128105) +StorageRegistryTest:testFuzzBatchRentRevertsIfPaused(address,uint256[],uint16[]) (runs: 512, μ: 145607, ~: 134728) +StorageRegistryTest:testFuzzBatchRentRevertsInsufficientPayment(address,uint256[],uint16[],uint256) (runs: 512, μ: 334494, ~: 299632) +StorageRegistryTest:testFuzzBatchRentRevertsMismatchedArrayLength(address,uint256[],uint16[]) (runs: 512, μ: 140302, ~: 129422) +StorageRegistryTest:testFuzzCannotSetMaxEqualOrBelowMin(uint256) (runs: 512, μ: 19933, ~: 20252) +StorageRegistryTest:testFuzzCannotSetMinEqualOrAboveMax(uint256) (runs: 512, μ: 19936, ~: 19627) +StorageRegistryTest:testFuzzContinuousCredit(uint16,uint256,uint32) (runs: 512, μ: 859969, ~: 741056) +StorageRegistryTest:testFuzzContinuousCreditRevertsExceedsCapacity(uint16,uint256,uint32) (runs: 512, μ: 74624, ~: 74798) +StorageRegistryTest:testFuzzContinuousCreditRevertsIfDeprecated(uint16,uint256,uint32) (runs: 512, μ: 21806, ~: 21983) +StorageRegistryTest:testFuzzContinuousCreditRevertsIfPaused(uint16,uint256,uint32) (runs: 512, μ: 32417, ~: 32594) +StorageRegistryTest:testFuzzContinuousCreditRevertsStartGteEnd(uint16,uint256) (runs: 512, μ: 21663, ~: 21816) +StorageRegistryTest:testFuzzContinuousCreditRevertsZeroAmount(uint16,uint256) (runs: 512, μ: 21661, ~: 21846) +StorageRegistryTest:testFuzzCredit(uint256,uint32) (runs: 512, μ: 52918, ~: 52746) +StorageRegistryTest:testFuzzCreditRevertsExceedsCapacity(uint256,uint32) (runs: 512, μ: 71751, ~: 71741) +StorageRegistryTest:testFuzzCreditRevertsIfDeprecated(uint256,uint32) (runs: 512, μ: 16760, ~: 16760) +StorageRegistryTest:testFuzzCreditRevertsIfPaused(uint256,uint32) (runs: 512, μ: 27344, ~: 27344) +StorageRegistryTest:testFuzzCreditRevertsZeroUnits(uint256) (runs: 512, μ: 17465, ~: 17465) +StorageRegistryTest:testFuzzInitialPrice(uint128) (runs: 512, μ: 17616, ~: 17616) +StorageRegistryTest:testFuzzOnlyAuthorizedCanRefreshPrice(address) (runs: 512, μ: 17971, ~: 17971) +StorageRegistryTest:testFuzzOnlyOperatorCanBatchCredit(address,uint256[],uint256) (runs: 512, μ: 15161, ~: 15154) +StorageRegistryTest:testFuzzOnlyOperatorCanCredit(address,uint256,uint256) (runs: 512, μ: 13731, ~: 13731) +StorageRegistryTest:testFuzzOnlyOwnerCanPause(address) (runs: 512, μ: 13562, ~: 13562) +StorageRegistryTest:testFuzzOnlyOwnerCanSetCacheDuration(address,uint256) (runs: 512, μ: 13693, ~: 13693) +StorageRegistryTest:testFuzzOnlyOwnerCanSetDeprecationTime(address,uint256) (runs: 512, μ: 13624, ~: 13624) +StorageRegistryTest:testFuzzOnlyOwnerCanSetFixedEthUsdPrice(address,uint256) (runs: 512, μ: 13667, ~: 13667) +StorageRegistryTest:testFuzzOnlyOwnerCanSetGracePeriod(address,uint256) (runs: 512, μ: 13618, ~: 13618) +StorageRegistryTest:testFuzzOnlyOwnerCanSetMaxAge(address,uint256) (runs: 512, μ: 13644, ~: 13644) +StorageRegistryTest:testFuzzOnlyOwnerCanSetMaxAnswer(address,uint256) (runs: 512, μ: 13621, ~: 13621) +StorageRegistryTest:testFuzzOnlyOwnerCanSetMaxUnits(address,uint256) (runs: 512, μ: 13613, ~: 13613) +StorageRegistryTest:testFuzzOnlyOwnerCanSetMinAnswer(address,uint256) (runs: 512, μ: 13621, ~: 13621) +StorageRegistryTest:testFuzzOnlyOwnerCanSetPriceFeed(address,address) (runs: 512, μ: 13789, ~: 13789) +StorageRegistryTest:testFuzzOnlyOwnerCanSetUSDUnitPrice(address,uint256) (runs: 512, μ: 13668, ~: 13668) +StorageRegistryTest:testFuzzOnlyOwnerCanSetUptimeFeed(address,address) (runs: 512, μ: 13811, ~: 13811) +StorageRegistryTest:testFuzzOnlyOwnerCanSetVault(address,address) (runs: 512, μ: 13814, ~: 13814) +StorageRegistryTest:testFuzzOnlyOwnerCanUnpause(address) (runs: 512, μ: 13541, ~: 13541) +StorageRegistryTest:testFuzzOnlyTreasurerCanWithdraw(address,uint256) (runs: 512, μ: 11648, ~: 11648) +StorageRegistryTest:testFuzzPrice(uint48,uint128,int256) (runs: 512, μ: 91992, ~: 92132) +StorageRegistryTest:testFuzzPriceCached(uint48,uint128,int256) (runs: 512, μ: 46156, ~: 46035) +StorageRegistryTest:testFuzzPriceFeedFailure(address,uint256,uint256) (runs: 512, μ: 175451, ~: 175723) +StorageRegistryTest:testFuzzPriceFeedRevertsAnswerBelowBound(uint256) (runs: 512, μ: 90238, ~: 90554) +StorageRegistryTest:testFuzzPriceFeedRevertsInvalidPrice(int256) (runs: 512, μ: 54105, ~: 54170) +StorageRegistryTest:testFuzzRemoveFixedEthUsdPriceReenablesPriceFeed(uint256) (runs: 512, μ: 50022, ~: 50050) +StorageRegistryTest:testFuzzRent(address,uint256,uint200) (runs: 512, μ: 77176, ~: 77455) +StorageRegistryTest:testFuzzRentAndWithdraw(address,uint256,uint200,uint256) (runs: 512, μ: 126890, ~: 127007) +StorageRegistryTest:testFuzzRentCachedPrice(address,uint256,uint200,address,uint256,uint200,int256,uint256) (runs: 512, μ: 141238, ~: 141333) +StorageRegistryTest:testFuzzRentFailedRefundRevertsCallFailed(uint256,uint256,uint256) (runs: 512, μ: 79866, ~: 80111) +StorageRegistryTest:testFuzzRentFixedPrice(address,uint256,uint200,address,uint256,uint200,int256,uint256) (runs: 512, μ: 186820, ~: 186770) +StorageRegistryTest:testFuzzRentIntraBlockPriceDecrease(address,uint256,uint200,address,uint256,uint200,uint256) (runs: 512, μ: 173363, ~: 173569) +StorageRegistryTest:testFuzzRentIntraBlockPriceIncrease(address,uint256,uint200,address,uint256,uint200,uint256) (runs: 512, μ: 172849, ~: 172642) +StorageRegistryTest:testFuzzRentPriceRefresh(address,uint256,uint200,address,uint256,uint200,int256) (runs: 512, μ: 176683, ~: 176621) +StorageRegistryTest:testFuzzRentRefundsExcessPayment(uint256,uint256,uint256) (runs: 512, μ: 80836, ~: 81081) +StorageRegistryTest:testFuzzRentRevertsExceedsCapacity(address,uint256,uint256) (runs: 512, μ: 83698, ~: 83970) +StorageRegistryTest:testFuzzRentRevertsIfDeprecated(address,uint256,uint256) (runs: 512, μ: 34554, ~: 34829) +StorageRegistryTest:testFuzzRentRevertsInsufficientPayment(address,uint256,uint256,uint256) (runs: 512, μ: 52664, ~: 52642) +StorageRegistryTest:testFuzzRentRevertsWhenPaused(address,uint256,uint256) (runs: 512, μ: 55577, ~: 55849) +StorageRegistryTest:testFuzzRentRevertsZeroUnits(address,uint256) (runs: 512, μ: 27405, ~: 27405) +StorageRegistryTest:testFuzzSetCacheDuration(uint256) (runs: 512, μ: 22864, ~: 22921) +StorageRegistryTest:testFuzzSetDeprecationTime(uint256) (runs: 512, μ: 26489, ~: 26403) +StorageRegistryTest:testFuzzSetDeprecationTimeRevertsInPast(uint256) (runs: 512, μ: 18663, ~: 18666) +StorageRegistryTest:testFuzzSetFixedEthUsdPrice(uint256) (runs: 512, μ: 50691, ~: 50716) +StorageRegistryTest:testFuzzSetFixedEthUsdPriceOverridesPriceFeed(uint256) (runs: 512, μ: 61580, ~: 61605) +StorageRegistryTest:testFuzzSetFixedEthUsdPriceRevertsGreaterThanMaxPrice(uint256) (runs: 512, μ: 25461, ~: 25152) +StorageRegistryTest:testFuzzSetFixedEthUsdPriceRevertsLessThanMinPrice(uint256) (runs: 512, μ: 23397, ~: 23713) +StorageRegistryTest:testFuzzSetGracePeriod(uint256) (runs: 512, μ: 22948, ~: 23005) +StorageRegistryTest:testFuzzSetMaxAge(uint256) (runs: 512, μ: 22976, ~: 23033) +StorageRegistryTest:testFuzzSetMaxAnswer(uint256) (runs: 512, μ: 29906, ~: 29605) +StorageRegistryTest:testFuzzSetMaxUnitsEmitsEvent(uint256) (runs: 512, μ: 22952, ~: 23009) +StorageRegistryTest:testFuzzSetMinAnswer(uint256) (runs: 512, μ: 29780, ~: 30102) +StorageRegistryTest:testFuzzSetPriceFeed(address) (runs: 512, μ: 23480, ~: 23490) +StorageRegistryTest:testFuzzSetUSDUnitPrice(uint256) (runs: 512, μ: 22930, ~: 22987) +StorageRegistryTest:testFuzzSetUptimeFeed(address) (runs: 512, μ: 23503, ~: 23513) +StorageRegistryTest:testFuzzSetVault(address) (runs: 512, μ: 25038, ~: 25038) +StorageRegistryTest:testFuzzUnitPriceCached(uint48,int256) (runs: 512, μ: 45834, ~: 45617) +StorageRegistryTest:testFuzzUnitPriceRefresh(uint48,int256) (runs: 512, μ: 91749, ~: 91862) +StorageRegistryTest:testFuzzUptimeFeedFailure(address,uint256,uint256) (runs: 512, μ: 141997, ~: 142269) +StorageRegistryTest:testFuzzUptimeFeedRevertsInvalidTimestamp(uint256) (runs: 512, μ: 63357, ~: 63338) +StorageRegistryTest:testFuzzUptimeFeedRevertsSequencerDown(int256) (runs: 512, μ: 58571, ~: 58571) +StorageRegistryTest:testFuzzWithdraw(uint256) (runs: 512, μ: 58823, ~: 58825) +StorageRegistryTest:testFuzzWithdrawalRevertsCallFailed(uint256) (runs: 512, μ: 36389, ~: 36468) +StorageRegistryTest:testFuzzWithdrawalRevertsInsufficientFunds(uint256) (runs: 512, μ: 52714, ~: 52711) +StorageRegistryTest:testInitialPriceUpdate() (gas: 47841) +StorageRegistryTest:testInitialUnitPrice() (gas: 17308) +StorageRegistryTest:testLastPriceFeedUpdateBlockDefault() (gas: 10506) +StorageRegistryTest:testLastPriceFeedUpdateDefault() (gas: 10551) +StorageRegistryTest:testMaxUnitsDefault() (gas: 10531) +StorageRegistryTest:testOnlyOperatorCanContinuousCredit(address,uint16,uint256,uint32) (runs: 512, μ: 18871, ~: 19016) +StorageRegistryTest:testPauseUnpause() (gas: 23067) +StorageRegistryTest:testPrevEthUSDPriceDefault() (gas: 10572) +StorageRegistryTest:testPriceFeedCacheDurationDefault() (gas: 10487) +StorageRegistryTest:testPriceFeedDefault() (gas: 12801) +StorageRegistryTest:testPriceFeedMaxAgeDefault() (gas: 10575) +StorageRegistryTest:testPriceFeedMaxAnswerDefault() (gas: 10592) +StorageRegistryTest:testPriceFeedMinAnswerDefault() (gas: 10509) +StorageRegistryTest:testPriceFeedRevertsAnswerAboveBound(uint256) (runs: 512, μ: 92142, ~: 92103) +StorageRegistryTest:testPriceFeedRevertsIncompleteRound() (gas: 93429) +StorageRegistryTest:testPriceFeedRevertsInvalidTimestamp() (gas: 98418) +StorageRegistryTest:testPriceFeedRevertsStaleAnswerByMaxAge() (gas: 98112) +StorageRegistryTest:testPriceFeedRevertsZeroRoundId() (gas: 75246) +StorageRegistryTest:testPriceRoundsUp() (gas: 89422) +StorageRegistryTest:testRentedUnitsDefault() (gas: 10486) +StorageRegistryTest:testRoles() (gas: 10662) +StorageRegistryTest:testSetVaultCannotBeZeroAddress() (gas: 13187) +StorageRegistryTest:testUptimeFeedDefault() (gas: 12790) +StorageRegistryTest:testUptimeFeedGracePeriodDefault() (gas: 10508) +StorageRegistryTest:testUptimeFeedRevertsGracePeriodNotOver() (gas: 60800) +StorageRegistryTest:testUptimeFeedRevertsIncompleteRound() (gas: 74708) +StorageRegistryTest:testUptimeFeedRevertsZeroRoundId() (gas: 56520) +StorageRegistryTest:testUsdUnitPriceDefault() (gas: 10509) +StorageRegistryTest:testVersion() (gas: 9878) \ No newline at end of file