tezos-checker / checker

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

Call ensure_no_tez_given only once in checkerMain #276

Closed gkaracha closed 3 years ago

gkaracha commented 3 years ago

Initially this change will break a bunch of tests, but that's OK. What is more important is to evaluate whether gas costs overall go up or down:

Either way, this PR shall close #275.

github-actions[bot] commented 3 years ago
Gas costs 9b59ce4b50781baf78895227a9d4b416e49e8272 f37e6c99f963012d61fd9bb20b32225eaa443121 Diff
checker%touch 30618 30568 -50
checker%add_liquidity 12732 12711 -21
checker%deactivate_burrow 23153 23132 -21
checker%mint_kit 7004 6983 -21
checker%burn_kit 7232 7211 -21
checker%deposit_collateral 19760 19739 -21
checker%withdraw_collateral 22794 22773 -21
checker%remove_liquidity 12662 12641 -21
checker%sell_kit 11812 11791 -21
checker%touch_burrow 5997 5977 -20
checker%create_burrow 22059 22039 -20
checker%update_operators 5485 5465 -20
checker%activate_burrow 19575 19555 -20
checker%set_burrow_delegate 18084 18064 -20
checker%buy_kit 12579 12560 -19
checker%transfer 6206 6190 -16
Entrypoint sizes 9b59ce4b50781baf78895227a9d4b416e49e8272 f37e6c99f963012d61fd9bb20b32225eaa443121 Diff
create_burrow 1223 1190 -33
touch_burrow 642 609 -33
cancel_liquidation_slice 12157 12124 -33
activate_burrow 1303 1270 -33
liquidation_auction_place_bid 2206 2173 -33
receive_price 155 122 -33
deposit_collateral 1176 1143 -33
touch 56559 56526 -33
buy_kit 1352 1319 -33
mint_kit 1550 1517 -33
deactivate_burrow 1496 1463 -33
add_liquidity 1835 1802 -33
withdraw_collateral 1329 1296 -33
update_operators 468 435 -33
remove_liquidity 1955 1922 -33
set_burrow_delegate 490 457 -33
touch_liquidation_slices 14371 14338 -33
mark_for_liquidation 16992 16959 -33
sell_kit 1348 1315 -33
burn_kit 1527 1494 -33
liquidation_auction_claim_win 1129 1096 -33
Test coverage 9b59ce4b50781baf78895227a9d4b416e49e8272 f37e6c99f963012d61fd9bb20b32225eaa443121 Diff
common.ml 97.89 96.84 -1.0499999999999972
checker.ml 91.21 90.77 -0.4399999999999977
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 94.08 93.97 -0.10999999999999943
gkaracha commented 3 years ago

Great, according to the comment above gas costs go down slightly by sharing the check. I'll see if test coverage needs patching before undrafting.

dorranh commented 3 years ago

gas costs go down slightly by sharing the check

Awesome, that's great news!

github-actions[bot] commented 3 years ago
Gas costs 9b59ce4b50781baf78895227a9d4b416e49e8272 eb09bd671f45f7cef6c3b52e47f344dd4db77c3d Diff
checker%touch 30618 30568 -50
checker%mint_kit 7004 6983 -21
checker%withdraw_collateral 22794 22773 -21
checker%deposit_collateral 19760 19739 -21
checker%add_liquidity 12732 12711 -21
checker%sell_kit 11812 11791 -21
checker%burn_kit 7232 7211 -21
checker%deactivate_burrow 23153 23132 -21
checker%remove_liquidity 12662 12641 -21
checker%buy_kit 12579 12559 -20
checker%touch_burrow 5997 5977 -20
checker%update_operators 5485 5465 -20
checker%set_burrow_delegate 18084 18064 -20
checker%create_burrow 22059 22039 -20
checker%activate_burrow 19575 19555 -20
checker%transfer 6206 6190 -16
Entrypoint sizes 9b59ce4b50781baf78895227a9d4b416e49e8272 eb09bd671f45f7cef6c3b52e47f344dd4db77c3d Diff
deposit_collateral 1176 1143 -33
touch_liquidation_slices 14371 14338 -33
liquidation_auction_claim_win 1129 1096 -33
mark_for_liquidation 16992 16959 -33
burn_kit 1527 1494 -33
create_burrow 1223 1190 -33
cancel_liquidation_slice 12157 12124 -33
withdraw_collateral 1329 1296 -33
deactivate_burrow 1496 1463 -33
mint_kit 1550 1517 -33
remove_liquidity 1955 1922 -33
receive_price 155 122 -33
add_liquidity 1835 1802 -33
buy_kit 1352 1319 -33
sell_kit 1348 1315 -33
touch_burrow 642 609 -33
update_operators 468 435 -33
activate_burrow 1303 1270 -33
set_burrow_delegate 490 457 -33
liquidation_auction_place_bid 2206 2173 -33
touch 56559 56526 -33
Test coverage 9b59ce4b50781baf78895227a9d4b416e49e8272 eb09bd671f45f7cef6c3b52e47f344dd4db77c3d Diff
checker.ml 91.21 90.77 -0.4399999999999977
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 94.08 94.02 -0.060000000000002274
github-actions[bot] commented 3 years ago
Gas costs 79de464c51c1b8855a6456e546915a6119544954 404ddf9220d8d79012288039d887c5f61bd307dc Diff
checker%touch 30623 30573 -50
checker%deactivate_burrow 23153 23132 -21
checker%sell_kit 11812 11791 -21
checker%mint_kit 7004 6983 -21
checker%deposit_collateral 19760 19739 -21
checker%add_liquidity 12732 12711 -21
checker%burn_kit 7232 7211 -21
checker%withdraw_collateral 22794 22773 -21
checker%remove_liquidity 12662 12641 -21
checker%activate_burrow 19575 19555 -20
checker%update_operators 5485 5465 -20
checker%create_burrow 22059 22039 -20
checker%set_burrow_delegate 18084 18064 -20
checker%touch_burrow 5997 5977 -20
checker%buy_kit 12579 12559 -20
checker%transfer 6206 6190 -16
Entrypoint sizes 79de464c51c1b8855a6456e546915a6119544954 404ddf9220d8d79012288039d887c5f61bd307dc Diff
burn_kit 1527 1494 -33
mint_kit 1550 1517 -33
touch_liquidation_slices 14371 14338 -33
activate_burrow 1303 1270 -33
liquidation_auction_place_bid 2206 2173 -33
withdraw_collateral 1329 1296 -33
receive_price 155 122 -33
touch_burrow 642 609 -33
buy_kit 1352 1319 -33
deactivate_burrow 1496 1463 -33
update_operators 468 435 -33
sell_kit 1348 1315 -33
deposit_collateral 1176 1143 -33
create_burrow 1223 1190 -33
add_liquidity 1835 1802 -33
touch 56563 56530 -33
set_burrow_delegate 490 457 -33
liquidation_auction_claim_win 1129 1096 -33
remove_liquidity 1955 1922 -33
mark_for_liquidation 16992 16959 -33
cancel_liquidation_slice 12157 12124 -33
Test coverage 79de464c51c1b8855a6456e546915a6119544954 404ddf9220d8d79012288039d887c5f61bd307dc Diff
checker.ml 91.21 90.77 -0.4399999999999977
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 94.08 94.02 -0.060000000000002274
gkaracha commented 3 years ago

Well, better late than never, I guess :sweat_smile: @dorranh I noticed that we were far from exhaustive in the past with tests for unwanted tez, so I ended up adding a bunch of tests, for every possible execution path in CheckerMain.main. Even if now the check for unwanted tez happens eagerly, I perceive it as part of the specification of each entrypoint, so it felt reasonable to add tests for it explicitly.

github-actions[bot] commented 3 years ago
Gas costs 79de464c51c1b8855a6456e546915a6119544954 545929d874d8235a3967dab119d27b02bdbbee8a Diff
checker%touch 30623 30573 -50
checker%sell_kit 11812 11791 -21
checker%deposit_collateral 19760 19739 -21
checker%remove_liquidity 12662 12641 -21
checker%burn_kit 7232 7211 -21
checker%add_liquidity 12732 12711 -21
checker%deactivate_burrow 23153 23132 -21
checker%mint_kit 7004 6983 -21
checker%withdraw_collateral 22794 22773 -21
checker%buy_kit 12579 12559 -20
checker%update_operators 5485 5465 -20
checker%activate_burrow 19575 19555 -20
checker%set_burrow_delegate 18084 18064 -20
checker%create_burrow 22059 22039 -20
checker%touch_burrow 5997 5977 -20
checker%transfer 6206 6190 -16
Entrypoint sizes 79de464c51c1b8855a6456e546915a6119544954 545929d874d8235a3967dab119d27b02bdbbee8a Diff
mark_for_liquidation 16992 16959 -33
buy_kit 1352 1319 -33
liquidation_auction_place_bid 2206 2173 -33
mint_kit 1550 1517 -33
cancel_liquidation_slice 12157 12124 -33
activate_burrow 1303 1270 -33
touch_liquidation_slices 14371 14338 -33
add_liquidity 1835 1802 -33
sell_kit 1348 1315 -33
receive_price 155 122 -33
deposit_collateral 1176 1143 -33
withdraw_collateral 1329 1296 -33
create_burrow 1223 1190 -33
deactivate_burrow 1496 1463 -33
update_operators 468 435 -33
touch_burrow 642 609 -33
burn_kit 1527 1494 -33
liquidation_auction_claim_win 1129 1096 -33
set_burrow_delegate 490 457 -33
touch 56563 56530 -33
remove_liquidity 1955 1922 -33
Test coverage 79de464c51c1b8855a6456e546915a6119544954 545929d874d8235a3967dab119d27b02bdbbee8a Diff
checker.ml 91.21 90.77 -0.4399999999999977
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 94.08 94.02 -0.060000000000002274
github-actions[bot] commented 3 years ago
Gas costs 79de464c51c1b8855a6456e546915a6119544954 fbbfb321985b62855bb1edbe4fcd5d597e2ebd1c Diff
checker%touch 30623 30573 -50
checker%mint_kit 7004 6983 -21
checker%deposit_collateral 19760 19739 -21
checker%burn_kit 7232 7211 -21
checker%withdraw_collateral 22794 22773 -21
checker%sell_kit 11812 11791 -21
checker%add_liquidity 12732 12711 -21
checker%deactivate_burrow 23153 23132 -21
checker%buy_kit 12579 12559 -20
checker%create_burrow 22059 22039 -20
checker%set_burrow_delegate 18084 18064 -20
checker%update_operators 5485 5465 -20
checker%touch_burrow 5997 5977 -20
checker%activate_burrow 19575 19555 -20
checker%remove_liquidity 12662 12642 -20
checker%transfer 6206 6190 -16
Entrypoint sizes 79de464c51c1b8855a6456e546915a6119544954 fbbfb321985b62855bb1edbe4fcd5d597e2ebd1c Diff
receive_price 155 122 -33
withdraw_collateral 1329 1296 -33
buy_kit 1352 1319 -33
liquidation_auction_place_bid 2206 2173 -33
touch_burrow 642 609 -33
touch_liquidation_slices 14371 14338 -33
cancel_liquidation_slice 12157 12124 -33
create_burrow 1223 1190 -33
mark_for_liquidation 16992 16959 -33
mint_kit 1550 1517 -33
deactivate_burrow 1496 1463 -33
burn_kit 1527 1494 -33
update_operators 468 435 -33
activate_burrow 1303 1270 -33
liquidation_auction_claim_win 1129 1096 -33
deposit_collateral 1176 1143 -33
set_burrow_delegate 490 457 -33
touch 56563 56530 -33
add_liquidity 1835 1802 -33
remove_liquidity 1955 1922 -33
sell_kit 1348 1315 -33
Test coverage 79de464c51c1b8855a6456e546915a6119544954 fbbfb321985b62855bb1edbe4fcd5d597e2ebd1c Diff
checker.ml 91.21 90.77 -0.4399999999999977
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 94.08 94.02 -0.060000000000002274
github-actions[bot] commented 3 years ago
Gas costs d75390a07bf73da213ba3777644387c10951670f 90c55559cf9761cfe11f48ed9201009ad47b07b1 Diff
checker%touch 30623 30573 -50
checker%buy_kit 12580 12559 -21
checker%withdraw_collateral 22794 22773 -21
checker%deposit_collateral 19760 19739 -21
checker%remove_liquidity 12662 12641 -21
checker%add_liquidity 12732 12711 -21
checker%sell_kit 11812 11791 -21
checker%deactivate_burrow 23153 23132 -21
checker%mint_kit 7004 6983 -21
checker%burn_kit 7232 7211 -21
checker%activate_burrow 19575 19555 -20
checker%update_operators 5485 5465 -20
checker%touch_burrow 5997 5977 -20
checker%create_burrow 22059 22039 -20
checker%set_burrow_delegate 18084 18064 -20
checker%transfer 6206 6190 -16
Entrypoint sizes d75390a07bf73da213ba3777644387c10951670f 90c55559cf9761cfe11f48ed9201009ad47b07b1 Diff
withdraw_collateral 1329 1296 -33
deactivate_burrow 1496 1463 -33
burn_kit 1527 1494 -33
touch 56563 56530 -33
receive_price 155 122 -33
add_liquidity 1835 1802 -33
liquidation_auction_place_bid 2206 2173 -33
touch_burrow 642 609 -33
sell_kit 1348 1315 -33
touch_liquidation_slices 14371 14338 -33
mark_for_liquidation 16992 16959 -33
deposit_collateral 1176 1143 -33
set_burrow_delegate 490 457 -33
update_operators 468 435 -33
buy_kit 1352 1319 -33
liquidation_auction_claim_win 1129 1096 -33
remove_liquidity 1955 1922 -33
mint_kit 1550 1517 -33
cancel_liquidation_slice 12157 12124 -33
activate_burrow 1303 1270 -33
create_burrow 1223 1190 -33
Test coverage d75390a07bf73da213ba3777644387c10951670f 90c55559cf9761cfe11f48ed9201009ad47b07b1 Diff
checker.ml 95.69 95.46 -0.23000000000000398
checkerMain.ml 93.02 93.18 0.1600000000000108
TOTAL 93.38 93.32 -0.060000000000002274