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

feat: add crosschain properties #24

Closed

Conversation

0xDiscotech
Copy link

  • refactor: allow for atomicity on mock messenger

  • refactor: cross domain sender logic on mock messenger

  • refactor: l2 to l2 caller and messenge sender logic

  • chore: remove assumes for removed checks on mock messenger


On the mock messenger, I had to return immutable vars on cross domain sender function due to the same problem with the storage layout. The same happens with the destination chain value on sendMessage.

To run the files: just test-halmos-all

CLOSES FUZZ-32

@0xDiscotech 0xDiscotech self-assigned this Aug 17, 2024
uint256 _totalSupplyBefore = optimismSuperchainERC20.totalSupply();
uint256 _fromBalanceBefore = optimismSuperchainERC20.balanceOf(_from);
uint256 _totalSupplyBefore = sourceToken.totalSupply();
uint256 _fromBalanceBefore = sourceToken.balanceOf(_from);
Copy link
Member

Choose a reason for hiding this comment

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

nit> assert for to too

@@ -28,23 +42,24 @@ contract MockL2ToL2Messenger is IL2ToL2CrossDomainMessenger {
address _target,
bytes calldata _message
)
external
public

Choose a reason for hiding this comment

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

why this change?

Copy link
Author

Choose a reason for hiding this comment

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

Don't know why, will undo

@0xDiscotech 0xDiscotech changed the base branch from feat/halmos-symbolic-tests to feat/invariant-testing August 26, 2024 15:04
@0xDiscotech 0xDiscotech force-pushed the feat/add-crosschain-properties branch from 608e74a to 2239e0f Compare August 26, 2024 15:41
* refactor: allow for atomicity on mock messenger

* refactor: cross domain sender logic on mock messenger

* refactor: l2 to l2 caller and messenge sender logic

* chore: remove assumes for removed checks on mock messenger
@0xteddybear 0xteddybear force-pushed the feat/add-crosschain-properties branch from 2239e0f to 773a1d8 Compare August 26, 2024 16:24
Copy link

@0xteddybear 0xteddybear left a comment

Choose a reason for hiding this comment

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

minor comments + properties should be marked as tested in PROPERTIES.md

@@ -89,21 +114,18 @@ contract SymTest_OptimismSuperchainERC20 is SymTest, HalmosBase {
vm.assume(_to != address(0));
// Deploying a new messenger because of an issue of not being able to etch the storage layout of the mock
// contract. So needed to a new one setting the symbolic immutable variable for the crossDomainSender.
vm.etch(address(MESSENGER), address(new MockL2ToL2Messenger(_crossDomainSender)).code);
// Used 0 address on source token so when the `soureToken` calls it if returns the symbolic `_crossDomainSender`

Choose a reason for hiding this comment

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

debugging this must've been the opposite of fun 😁

@@ -5,6 +5,7 @@ import { Test } from "forge-std/Test.sol";

contract HalmosBase is Test {
uint256 internal constant CURRENT_CHAIN_ID = 1;
uint256 internal constant DESTINATION_CHAIN_ID = 2;

Choose a reason for hiding this comment

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

old variable isn't used anymore

Copy link

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Sep 10, 2024
@0xDiscotech
Copy link
Author

The symbolic tests will be written and proved using Kontrol instead

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

Successfully merging this pull request may close these issues.

3 participants