tezos-checker / checker

An in-development "robocoin" system for the Tezos blockchain
24 stars 16 forks source link

Additional unit tests for operations returned by entrypoints #219

Closed dorranh closed 3 years ago

dorranh commented 3 years ago

Similar to #214, this PR adds unit tests for operations emitted by entrypoints in checker.ml. Some of these tests also overlap with assertions in the can complete a liquidation auction test, but I think it is cleaner to have individual unit tests for them as well.

To be able to efficiently write these, I ended up adding a group of test fixture-like functions in testChecker.ml for producing instances of checker with different liquidation auction states. I think these will prove more generally useful as we add more unit tests related to liquidation auctions.

Entrypoints covered include:

github-actions[bot] commented 3 years ago

hidden diff-with-None comment here.

github-actions[bot] commented 3 years ago
Gas costs af8d44c2b645fe8df17a700682c45cc48f40375e 8e3a541f6824a0a8cbc1126985b22c4b2e30305f Diff
touch 538005 537980 -25
buy_kit 69526 69518 -8
transfer 39924 39918 -6
update_operators 41668 41662 -6
remove_liquidity 73790 73784 -6
touch_burrow 44405 44399 -6
withdraw_tez 57584 57578 -6
burn_kit 51282 51276 -6
mint_kit 52111 52105 -6
deactivate_burrow 59027 59021 -6
deposit_tez 53015 53009 -6
add_liquidity 73538 73532 -6
set_burrow_delegate 54687 54681 -6
activate_burrow 53700 53694 -6
create_burrow 47817 47811 -6
sell_kit 68651 68645 -6
Entrypoint sizes: No change. Test coverage af8d44c2b645fe8df17a700682c45cc48f40375e 8e3a541f6824a0a8cbc1126985b22c4b2e30305f Diff
ctez.ml 100 None -100
parameters.ml 100 None -100
lqt.ml 100 None -100
cfmmTypes.ml 100 None -100
checkerEntrypoints.ml 100 None -100
ptr.ml 100 None -100
liquidationAuctionTypes.ml 100 None -100
fixedPoint.ml 100 None -100
common.ml 100 None -100
error.ml 100 None -100
mem.ml 100 None -100
checkerTypes.ml 100 None -100
fa2Interface.ml 100 None -100
kit.ml 100 None -100
constants.ml 100 None -100
cfmm.ml 100 None -100
burrow.ml 96.54 None -96.54
sliceList.ml 95.38 None -95.38
checkerMain.ml 92.86 None -92.86
avl.ml 91.05 None -91.05
checker.ml 87.1 None -87.1
liquidationAuction.ml 76.28 None -76.28
TOTAL 93.17 None -93.17
github-actions[bot] commented 3 years ago
Gas costs af8d44c2b645fe8df17a700682c45cc48f40375e 42b48aaaafdf314cf91b656bc19637a8f40a23a6 Diff
touch 538005 537980 -25
buy_kit 69526 69518 -8
transfer 39924 39918 -6
update_operators 41668 41662 -6
remove_liquidity 73790 73784 -6
touch_burrow 44405 44399 -6
withdraw_tez 57584 57578 -6
burn_kit 51282 51276 -6
mint_kit 52111 52105 -6
deactivate_burrow 59027 59021 -6
deposit_tez 53015 53009 -6
add_liquidity 73538 73532 -6
set_burrow_delegate 54687 54681 -6
activate_burrow 53700 53694 -6
create_burrow 47817 47811 -6
sell_kit 68651 68645 -6
Entrypoint sizes: No change. Test coverage af8d44c2b645fe8df17a700682c45cc48f40375e 42b48aaaafdf314cf91b656bc19637a8f40a23a6 Diff
ctez.ml 100 None -100
parameters.ml 100 None -100
lqt.ml 100 None -100
cfmmTypes.ml 100 None -100
checkerEntrypoints.ml 100 None -100
ptr.ml 100 None -100
liquidationAuctionTypes.ml 100 None -100
fixedPoint.ml 100 None -100
common.ml 100 None -100
error.ml 100 None -100
mem.ml 100 None -100
checkerTypes.ml 100 None -100
fa2Interface.ml 100 None -100
kit.ml 100 None -100
constants.ml 100 None -100
cfmm.ml 100 None -100
burrow.ml 96.54 None -96.54
sliceList.ml 95.38 None -95.38
checkerMain.ml 92.86 None -92.86
avl.ml 91.05 None -91.05
checker.ml 87.1 None -87.1
liquidationAuction.ml 76.28 None -76.28
TOTAL 93.17 None -93.17
gkaracha commented 3 years ago

Also, since we've come this far (this applies to the tests that follow as well), we might as well check that the whole effect of the operation called is as expected (i.e., inspect the resulting checker too, and for example in this case check that the current winning bid is the one we placed).

Actually, now that I went through our issue tracker I saw that we have #153 about this. If we enhance the tests here @dorranh, we can probably finally close that issue.

dorranh commented 3 years ago

Awesome, thanks for the review and assist on this while I was out!