Skip to content

Commit

Permalink
fix: feedback from doc
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Sep 2, 2024
1 parent a15804c commit 63d86dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { console } from "forge-std/console.sol";

/// @title CompatibleAssert
/// @notice meant to add compatibility between medusa assertion tests and
/// foundry invariant test's required arquitecture
/// foundry invariant test's required architecture
contract CompatibleAssert {
bool public failed;

Expand All @@ -15,10 +15,13 @@ contract CompatibleAssert {

function compatibleAssert(bool condition, string memory message) internal {
if (!condition) {
if(bytes(message).length != 0) console.log("Assertion failed: ", message);
else console.log("Assertion failed");

// for foundry to call & check
failed = true;

// for medusa
console.log("Assertion failed: ", message);
assert(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ contract ProtocolHandler is TestBase, StdUtils, Actors {
{
// this salt would be used in production. Tokens sharing it will be bridgable with each other
bytes32 realSalt = keccak256(abi.encode(remoteToken, name, symbol, decimals));
// Foundry invariant erroneously show other unrelated invariant breaking
// when this deployment fails due to a create2 collision, so we revert eagerly instead
require(MESSENGER.superTokenAddresses(chainId, realSalt) == address(0), "skip duplicate deployment");

// what we use in the tests to walk around two contracts needing two different addresses
Expand Down

0 comments on commit 63d86dc

Please sign in to comment.