sei-protocol / sei-chain

Apache License 2.0
2.7k stars 805 forks source link

Add migration to unwind dex state #1734

Closed udpatil closed 3 months ago

udpatil commented 3 months ago

Describe your changes and provide context

This disables many of the dex message types, and also unregisters existing contracts while handling module balances by refunding rents + handling excess balances.

Testing performed to validate your change

Add unit tests

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 59.45946% with 15 lines in your changes missing coverage. Please review.

Project coverage is 60.78%. Comparing base (08204c6) to head (815e7f2).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734/graphs/tree.svg?width=650&height=150&src=pr&token=DG7ZZJ3PVV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #1734 +/- ## ======================================== Coverage 60.78% 60.78% ======================================== Files 371 372 +1 Lines 27479 27022 -457 ======================================== - Hits 16702 16426 -276 + Misses 9635 9497 -138 + Partials 1142 1099 -43 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [app/app.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-YXBwL2FwcC5nbw==) | `66.22% <ø> (ø)` | | | [app/upgrades.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=app%2Fupgrades.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-YXBwL3VwZ3JhZGVzLmdv) | `40.74% <ø> (ø)` | | | [x/dex/keeper/keeper.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fkeeper.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL2tlZXBlci5nbw==) | `84.61% <100.00%> (ø)` | | | [x/dex/keeper/msgserver/msg\_server\_cancel\_orders.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_cancel_orders.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX2NhbmNlbF9vcmRlcnMuZ28=) | `100.00% <100.00%> (+18.18%)` | :arrow_up: | | [...eper/msgserver/msg\_server\_contract\_deposit\_rent.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_contract_deposit_rent.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX2NvbnRyYWN0X2RlcG9zaXRfcmVudC5nbw==) | `100.00% <100.00%> (+47.05%)` | :arrow_up: | | [x/dex/keeper/msgserver/msg\_server\_place\_orders.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_place_orders.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX3BsYWNlX29yZGVycy5nbw==) | `100.00% <100.00%> (+17.14%)` | :arrow_up: | | [...x/keeper/msgserver/msg\_server\_register\_contract.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_register_contract.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX3JlZ2lzdGVyX2NvbnRyYWN0Lmdv) | `100.00% <100.00%> (+41.74%)` | :arrow_up: | | [.../dex/keeper/msgserver/msg\_server\_register\_pairs.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_register_pairs.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX3JlZ2lzdGVyX3BhaXJzLmdv) | `100.00% <100.00%> (+14.28%)` | :arrow_up: | | [...keeper/msgserver/msg\_server\_unregister\_contract.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_unregister_contract.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX3VucmVnaXN0ZXJfY29udHJhY3QuZ28=) | `100.00% <100.00%> (+54.16%)` | :arrow_up: | | [.../keeper/msgserver/msg\_server\_unsuspend\_contract.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree&filepath=x%2Fdex%2Fkeeper%2Fmsgserver%2Fmsg_server_unsuspend_contract.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-eC9kZXgva2VlcGVyL21zZ3NlcnZlci9tc2dfc2VydmVyX3Vuc3VzcGVuZF9jb250cmFjdC5nbw==) | `100.00% <100.00%> (+37.03%)` | :arrow_up: | | ... and [4 more](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1734/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)