Skip to content

Commit

Permalink
chore: run forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Sep 16, 2024
1 parent 8750c1b commit dc346c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit dc346c3

Please sign in to comment.