Skip to content

Commit

Permalink
test: only use assertion mode
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Aug 20, 2024
1 parent 51bf7fd commit 79bf5e5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/medusa.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"traceAll": true,
"assertionTesting": {
"enabled": true,
"testViewMethods": false,
"testViewMethods": true,
"panicCodeConfig": {
"failOnCompilerInsertedPanic": false,
"failOnAssertion": true,
Expand All @@ -43,7 +43,7 @@
}
},
"propertyTesting": {
"enabled": true,
"enabled": false,
"testPrefixes": [
"property_"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract ProtocolProperties is ProtocolHandler {
/// @custom:property-id 24
/// @custom:property sum of supertoken total supply across all chains is always equal to convert(legacy, super)-
/// convert(super, legacy)
function property_totalSupplyAcrossChainsEqualsMints() external view returns (bool success) {
function property_totalSupplyAcrossChainsEqualsMints() external view {
// iterate over unique deploy salts aka supertokens that are supposed to be compatible with each other
for (uint256 deploySaltIndex = 0; deploySaltIndex < ghost_totalSupplyAcrossChains.length(); deploySaltIndex++) {
uint256 totalSupply = 0;
Expand All @@ -26,17 +26,14 @@ contract ProtocolProperties is ProtocolHandler {
totalSupply += OptimismSuperchainERC20(supertoken).totalSupply();
}
}
if (trackedSupply != totalSupply) {
return false;
}
assert(trackedSupply == totalSupply);
}
return true;
}

/// @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(
function property_DeployNewSupertoken(
TokenDeployParams memory params,
uint256 chainId
)
Expand All @@ -61,7 +58,7 @@ contract ProtocolProperties is ProtocolHandler {
/// @custom:property-id 23
/// @custom:property sendERC20 decreases total supply in source chain and increases it in destination chain exactly
/// by the input amount
function fuzz_SelfBridgeSupertoken(uint256 fromIndex, uint256 destinationChainId, uint256 amount) external {
function property_SelfBridgeSupertoken(uint256 fromIndex, uint256 destinationChainId, uint256 amount) external {
destinationChainId = bound(destinationChainId, 0, MAX_CHAINS - 1);
fromIndex = bound(fromIndex, 0, allSuperTokens.length - 1);
OptimismSuperchainERC20 sourceToken = OptimismSuperchainERC20(allSuperTokens[fromIndex]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { Test } from "forge-std/Test.sol";
import { TestBase } from "forge-std/Base.sol";
import { StdUtils } from "forge-std/StdUtils.sol";

import { ERC1967Proxy } from "@openzeppelin/contracts-v5/proxy/ERC1967/ERC1967Proxy.sol";
import { EnumerableMap } from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import { OptimismSuperchainERC20 } from "src/L2/OptimismSuperchainERC20.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { MockL2ToL2CrossDomainMessenger } from "../../helpers/MockL2ToL2CrossDomainMessenger.t.sol";

contract ProtocolHandler is Test {
contract ProtocolHandler is TestBase, StdUtils {
using EnumerableMap for EnumerableMap.Bytes32ToUintMap;

uint8 internal constant MAX_CHAINS = 4;
Expand Down Expand Up @@ -61,14 +62,14 @@ contract ProtocolHandler is Test {
_;
}

function fuzz_MockNewRemoteToken() external {
function handler_MockNewRemoteToken() external {
_deployRemoteToken();
}

/// @notice pick one already-deployed supertoken and mint an arbitrary amount of it
/// necessary so there is something to be bridged :D
/// TODO: will be replaced when testing the factories and `convert()`
function fuzz_MintSupertoken(uint256 index, uint96 amount) external {
function handler_MintSupertoken(uint256 index, uint96 amount) external {
index = bound(index, 0, allSuperTokens.length - 1);
address addr = allSuperTokens[index];
vm.prank(BRIDGE);
Expand Down

0 comments on commit 79bf5e5

Please sign in to comment.