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

Add more assets in invariant tests #158

Merged
merged 3 commits into from
Jun 6, 2024
Merged

Conversation

andreivladbrg
Copy link
Member

@andreivladbrg andreivladbrg commented Jun 5, 2024

Linked issues

Changes

  • Add an array of assets in FlowCreateHandler
  • Add useFuzzedAsset modifier in FlowCreateHandler
  • Remove the unneeded Invariant_Test contract
  • Add a helper function in FlowCreateHandler to prevent Stack too deep error
  • Dry-fy the code by moving the test contracts in BaseHandler
  • Run invariant_ContractBalanceGeStreamBalances test for all assets
  • Use vm.assume instead of if(condition) return

Note: I wanted to add the array of assets from test/invariant/Flow.t.sol to Base_Test, but I didn’t do it to prevent git conflicts.

Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Nice work @andreivladbrg. I've left my feedback below.

test/invariant/handlers/BaseHandler.sol Show resolved Hide resolved
test/invariant/handlers/BaseHandler.sol Outdated Show resolved Hide resolved
test/invariant/handlers/FlowCreateHandler.sol Outdated Show resolved Hide resolved
test/invariant/handlers/FlowCreateHandler.sol Outdated Show resolved Hide resolved
test/invariant/handlers/FlowCreateHandler.sol Outdated Show resolved Hide resolved
test/invariant/handlers/FlowHandler.sol Outdated Show resolved Hide resolved
test/invariant/Flow.t.sol Show resolved Hide resolved
@smol-ninja
Copy link
Member

Note: I wanted to add the array of assets from test/invariant/Flow.t.sol to Base_Test, but I didn’t do it to prevent git conflicts

Unless, we are going to use this array in integration tests, I think its better to keep it in Flow contract.

test: add an array of assets in CreateHandler
test: fuzz the asset in CreateHandler
test: remove unneeded Invariant_Test contract
test: remove checkUsers modifier
test: move test contracts in BaseHandler
test: run invariant_ContractBalanceGeStreamBalances test for all assets
test: add a helper function to prevent stack too deep error
test: use assume instead of "if() return"
@andreivladbrg
Copy link
Member Author

@smol-ninja i've addressed your feedback, lmk if i missed anything

Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Lezzzz go 🚀

@andreivladbrg andreivladbrg merged commit 03b90c4 into main Jun 6, 2024
6 checks passed
@smol-ninja smol-ninja deleted the test/more-invariant-assets branch June 6, 2024 16:32
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.

Use vm.assume in invariant handlers instead of returning Add more assets in invariant tests
2 participants