Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: property 8 and 9 #188

Open
wants to merge 39 commits into
base: sc-feat/interop-testing-campaign
Choose a base branch
from

Conversation

hexshire
Copy link
Member

@hexshire hexshire commented Jan 8, 2025

CLOSES OPT-656

hexshire and others added 30 commits December 23, 2024 21:53
* chore: improve assertions

* feat: add ghost vars contract
* fix: weth invariants assertion

* fix: actors flow
…e to medusa error

* refactor: mint super tokens on setup and remove handler to mint them

* fix: some math on superweth properties
This reverts commit c37ea22.
Base automatically changed from test/interop-testing-campaign to sc-feat/interop-testing-campaign January 8, 2025 22:53
@hexshire hexshire changed the title test: property 8 test: property 8 and 9 Jan 9, 2025
Copy link

linear bot commented Jan 9, 2025

@hexshire hexshire self-assigned this Jan 10, 2025

assertWithMsg(
Utils.checkOverflow(address(SUPER_WETH).balance, _message.amount)
|| !Utils.checkBalance(ethLiquidityEthBalanceBefore, _message.amount)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use a function for this check

Copy link

@0xDiscotech 0xDiscotech Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is more self-explanatory to just have the line there, also the name doesn't exactly reflect what the check does

});

assertWithMsg(
Utils.checkOverflow(address(SUPER_WETH).balance, _message.amount)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like these functions. I don't think it harms to repeat that line wherever needed, since now you have to read the checkOverflow function to fully understand the check, and what is _a, what is _b?
This looks cleaner and simpler IMO

                // Check overflow
                address(SUPER_WETH).balance > type(uint256).max - _message.amount

if (success) {
assert(address(ETH_LIQUIDITY).balance == ethLiquidityEthBalanceBefore + _amount);
} else {
assertWithMsg(false, "Unknown Revert Error");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jic it reverts with another error

Suggested change
assertWithMsg(false, "Unknown Revert Error");
assert(false);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, why assert(false) and not checking overflow here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, becasue it is a precondition. I'd rather remove it from pre-condition and add it to the assertion since that's the property we're testing

Utils.checkOverflow(address(SUPER_WETH).balance, _message.amount)
|| !Utils.checkBalance(ethLiquidityEthBalanceBefore, _message.amount)
|| L2_TO_L2_MESSENGER.successfulMessages(messageHash), // Already relayed
"Unkonwn Revert Error"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about this. Why do we need to check for the "Unkonwn Revert Error" msg?
Does it have any advantage? I think we could be omitting the case where it reverts with one of the expected conditions, but with another log - and we don't really care about the log of Medusa on that check.
Wdyt?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants