From dc346c3d8b399da98723bf7626ec7874a8851505 Mon Sep 17 00:00:00 2001 From: teddy Date: Wed, 11 Sep 2024 12:49:12 -0300 Subject: [PATCH] chore: run forge fmt --- .../OptimismSuperchainERC20.t.sol | 3 ++- .../OptimismSuperchainERC20/fuzz/Protocol.guided.t.sol | 10 +++++++--- .../fuzz/Protocol.unguided.t.sol | 6 ++---- .../helpers/CompatibleAssert.t.sol | 2 +- .../helpers/HandlerGetters.t.sol | 1 + 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/OptimismSuperchainERC20.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/OptimismSuperchainERC20.t.sol index 189e569e992eb..d90e90a2f811c 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/OptimismSuperchainERC20.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/OptimismSuperchainERC20.t.sol @@ -72,7 +72,8 @@ contract OptimismSuperchainERC20Properties is Test { } } - /// @custom:invariant many other assertion mode invariants are also defined under `test/invariants/OptimismSuperchainERC20/fuzz/` . + /// @custom:invariant many other assertion mode invariants are also defined under + /// `test/invariants/OptimismSuperchainERC20/fuzz/` . /// /// since setting`fail_on_revert=false` also ignores StdAssertion failures, this invariant explicitly asks the /// handler for assertion test failures diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.guided.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.guided.t.sol index 2d9c8d52fab3b..536a4ea7025ae 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.guided.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.guided.t.sol @@ -5,13 +5,14 @@ import { MockL2ToL2CrossDomainMessenger } from "../helpers/MockL2ToL2CrossDomain import { OptimismSuperchainERC20 } from "src/L2/OptimismSuperchainERC20.sol"; import { ProtocolHandler } from "../handlers/Protocol.t.sol"; import { EnumerableMap } from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; -import { CompatibleAssert } from '../helpers/CompatibleAssert.t.sol'; +import { CompatibleAssert } from "../helpers/CompatibleAssert.t.sol"; contract ProtocolGuided is ProtocolHandler, CompatibleAssert { using EnumerableMap for EnumerableMap.Bytes32ToUintMap; /// @notice deploy a new supertoken with deploy salt determined by params, to the given (of course mocked) chainId /// @custom:property-id 14 /// @custom:property supertoken total supply starts at zero + function fuzz_deployNewSupertoken( TokenDeployParams memory params, uint256 chainId @@ -66,7 +67,9 @@ contract ProtocolGuided is ProtocolHandler, CompatibleAssert { uint256 sourceBalanceAfter = sourceToken.balanceOf(currentActor()); uint256 destinationBalanceAfter = destinationToken.balanceOf(recipient); // no free mint - compatibleAssert(sourceBalanceBefore + destinationBalanceBefore == sourceBalanceAfter + destinationBalanceAfter); + compatibleAssert( + sourceBalanceBefore + destinationBalanceBefore == sourceBalanceAfter + destinationBalanceAfter + ); // 22 compatibleAssert(sourceBalanceBefore - amount == sourceBalanceAfter); compatibleAssert(destinationBalanceBefore + amount == destinationBalanceAfter); @@ -124,7 +127,8 @@ contract ProtocolGuided is ProtocolHandler, CompatibleAssert { } /// @custom:property-id 11 - /// @custom:property relayERC20 increases the token's totalSupply in the destination chain exactly by the input amount + /// @custom:property relayERC20 increases the token's totalSupply in the destination chain exactly by the input + /// amount /// @custom:property-id 27 /// @custom:property relayERC20 increases sender's balance in the destination chain exactly by the input amount /// @custom:property-id 7 diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.unguided.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.unguided.t.sol index bf6d1386d409a..90cad38baa990 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.unguided.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/fuzz/Protocol.unguided.t.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.25; import { ProtocolHandler } from "../handlers/Protocol.t.sol"; import { EnumerableMap } from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; import { OptimismSuperchainERC20 } from "src/L2/OptimismSuperchainERC20.sol"; -import { CompatibleAssert } from '../helpers/CompatibleAssert.t.sol'; +import { CompatibleAssert } from "../helpers/CompatibleAssert.t.sol"; // TODO: add fuzz_sendERC20 when we implement non-atomic bridging -contract ProtocolUnguided is ProtocolHandler , CompatibleAssert{ +contract ProtocolUnguided is ProtocolHandler, CompatibleAssert { using EnumerableMap for EnumerableMap.Bytes32ToUintMap; /// @custom:property-id 7 @@ -82,7 +82,6 @@ contract ProtocolUnguided is ProtocolHandler , CompatibleAssert{ } } - /// @custom:property-id 12 /// @custom:property supertoken total supply only increases on calls to mint() by the L2toL2StandardBridge function fuzz_mint(uint256 tokenIndex, address to, address sender, uint256 amount) external { @@ -99,7 +98,6 @@ contract ProtocolUnguided is ProtocolHandler , CompatibleAssert{ } } - /// @custom:property-id 13 /// @custom:property supertoken total supply only increases on calls to mint() by the L2toL2StandardBridge function fuzz_burn(uint256 tokenIndex, address from, address sender, uint256 amount) external { diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/CompatibleAssert.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/CompatibleAssert.t.sol index 9cca12bf86499..4e69c94c85852 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/CompatibleAssert.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/CompatibleAssert.t.sol @@ -15,7 +15,7 @@ contract CompatibleAssert { function compatibleAssert(bool condition, string memory message) internal { if (!condition) { - if(bytes(message).length != 0) console.log("Assertion failed: ", message); + if (bytes(message).length != 0) console.log("Assertion failed: ", message); else console.log("Assertion failed"); // for foundry to call & check diff --git a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/HandlerGetters.t.sol b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/HandlerGetters.t.sol index 6120f5f756842..b081aa48c6bbc 100644 --- a/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/HandlerGetters.t.sol +++ b/packages/contracts-bedrock/test/invariants/OptimismSuperchainERC20/helpers/HandlerGetters.t.sol @@ -6,6 +6,7 @@ import { EnumerableMap } from "@openzeppelin/contracts/utils/structs/EnumerableM contract HandlerGetters is ProtocolHandler { using EnumerableMap for EnumerableMap.Bytes32ToUintMap; + function deploySaltsLength() external view returns (uint256 length) { return ghost_totalSupplyAcrossChains.length(); }