-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Sumtree]: E2E and Fuzz Testing #191
Conversation
…estriction in place limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this -- caught several important issues. The tests themselves LGTM, as do the fixes (which should already be merged in separately right?)
Yep! Changes from last weekend are here: |
What is the purpose of the change
These changes introduce a testing suite for end-to-end testing of the sumtree orderbook. Testing uses osmosis-test-tube so that the use of the CosmWasm Pool module can simultaneously be tested. There are currently two types of e2e tests:
test_orders
)test_fuzz
)The case based testing uses predefined values and expected outputs in order to ensure basic usage of the orderbook functions as intended. The fuzz testing suite attempts to randomly place a limit, claim a limit, cancel a limit or place a market order depending on the type of fuzz test being run. There are two types of fuzz tests:
There are many different tests for both of these types that require various inputs (such as amount of operations, tick ranges, cancel probability, etc). These are separate so that they may run asynchronously.
To help with both case based and fuzz testing a
utils
file is defined. This provides a setup macro and two modules;assert
andorder
, both providing relevant utility methods. The more complicated assertion logic is inbalance_changes
which takes in a desired action, records balances for the provided addresses before and after the action and compares the difference.One short coming of this testing suite is that testing the maker fee/admin functions is not possible due to a restriction with test-tube. Testing can be done by removing authorisation checks in the admin functions and having any address update the values but this is a risky adjustment and must be reverted before pushing any code.
Included is also an additional query for orderbook state and an adjustment for inclusion when querying orders.
Note: the contract must be compiled via
cargo wasm
after any adjustments before running these testsTesting and Verifying
All tests can be run using:
These tests can be skipped by running:
Testing Outcomes
End-to-end testing caught the following issues: